From e6e4f92b927f56bb7e5094910c5f20dca47985fa Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Wed, 27 Nov 2024 15:05:56 +0100 Subject: [PATCH] Rust: Add a model for `unwrap` --- .../lib/codeql/rust/dataflow/FlowSummary.qll | 11 + .../dataflow/local/DataFlowStep.expected | 369 +++++++++--------- .../dataflow/local/inline-flow.expected | 76 ++-- .../test/library-tests/dataflow/local/main.rs | 6 + 4 files changed, 246 insertions(+), 216 deletions(-) diff --git a/rust/ql/lib/codeql/rust/dataflow/FlowSummary.qll b/rust/ql/lib/codeql/rust/dataflow/FlowSummary.qll index 13206803f028..bbeb33ad13a6 100644 --- a/rust/ql/lib/codeql/rust/dataflow/FlowSummary.qll +++ b/rust/ql/lib/codeql/rust/dataflow/FlowSummary.qll @@ -7,6 +7,17 @@ private import internal.DataFlowImpl // import all instances below private module Summaries { private import codeql.rust.Frameworks + + // TODO: Used models-as-data when it's available + private class UnwrapSummary extends SummarizedCallable::Range { + UnwrapSummary() { this = "lang:core::_::::unwrap" } + + override predicate propagatesFlow(string input, string output, boolean preservesValue) { + input = "Argument[self].Variant[crate::std::option::Option::Some(0)]" and + output = "ReturnValue" and + preservesValue = true + } + } } /** Provides the `Range` class used to define the extent of `LibraryCallable`. */ diff --git a/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected b/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected index a49da7516790..6d6c35c3059e 100644 --- a/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected +++ b/rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected @@ -114,193 +114,198 @@ localStep | main.rs:124:14:124:14 | n | main.rs:124:14:124:14 | [SSA] n | | main.rs:124:20:124:26 | sink(...) | main.rs:123:5:126:5 | match s2 { ... } | | main.rs:125:17:125:23 | sink(...) | main.rs:123:5:126:5 | match s2 { ... } | -| main.rs:135:9:135:10 | [SSA] s1 | main.rs:137:11:137:12 | s1 | -| main.rs:135:9:135:10 | s1 | main.rs:135:9:135:10 | [SSA] s1 | -| main.rs:135:14:135:39 | ...::A(...) | main.rs:135:9:135:10 | s1 | -| main.rs:136:9:136:10 | [SSA] s2 | main.rs:144:11:144:12 | s2 | -| main.rs:136:9:136:10 | s2 | main.rs:136:9:136:10 | [SSA] s2 | -| main.rs:136:14:136:30 | ...::B(...) | main.rs:136:9:136:10 | s2 | -| main.rs:137:11:137:12 | s1 | main.rs:138:9:138:25 | TupleStructPat | -| main.rs:137:11:137:12 | s1 | main.rs:139:9:139:25 | TupleStructPat | -| main.rs:137:11:137:12 | s1 | main.rs:141:11:141:12 | s1 | -| main.rs:138:24:138:24 | [SSA] n | main.rs:138:35:138:35 | n | -| main.rs:138:24:138:24 | n | main.rs:138:24:138:24 | [SSA] n | -| main.rs:138:30:138:36 | sink(...) | main.rs:137:5:140:5 | match s1 { ... } | -| main.rs:139:24:139:24 | [SSA] n | main.rs:139:35:139:35 | n | -| main.rs:139:24:139:24 | n | main.rs:139:24:139:24 | [SSA] n | -| main.rs:139:30:139:36 | sink(...) | main.rs:137:5:140:5 | match s1 { ... } | -| main.rs:141:11:141:12 | s1 | main.rs:142:10:142:46 | ... \| ... | -| main.rs:142:10:142:46 | ... \| ... | main.rs:142:10:142:26 | TupleStructPat | -| main.rs:142:10:142:46 | ... \| ... | main.rs:142:30:142:46 | TupleStructPat | -| main.rs:142:10:142:46 | [SSA] [match(true)] phi | main.rs:142:57:142:57 | n | -| main.rs:142:25:142:25 | [SSA] [input] [match(true)] phi | main.rs:142:10:142:46 | [SSA] [match(true)] phi | -| main.rs:142:25:142:25 | [SSA] n | main.rs:142:25:142:25 | [SSA] [input] [match(true)] phi | -| main.rs:142:25:142:25 | n | main.rs:142:25:142:25 | [SSA] n | -| main.rs:142:45:142:45 | [SSA] [input] [match(true)] phi | main.rs:142:10:142:46 | [SSA] [match(true)] phi | -| main.rs:142:45:142:45 | [SSA] n | main.rs:142:45:142:45 | [SSA] [input] [match(true)] phi | -| main.rs:142:45:142:45 | n | main.rs:142:45:142:45 | [SSA] n | -| main.rs:142:52:142:58 | sink(...) | main.rs:141:5:143:5 | match s1 { ... } | -| main.rs:144:5:147:5 | match s2 { ... } | main.rs:134:48:148:1 | { ... } | -| main.rs:144:11:144:12 | s2 | main.rs:145:9:145:25 | TupleStructPat | -| main.rs:144:11:144:12 | s2 | main.rs:146:9:146:25 | TupleStructPat | -| main.rs:145:24:145:24 | [SSA] n | main.rs:145:35:145:35 | n | -| main.rs:145:24:145:24 | n | main.rs:145:24:145:24 | [SSA] n | -| main.rs:145:30:145:36 | sink(...) | main.rs:144:5:147:5 | match s2 { ... } | -| main.rs:146:24:146:24 | [SSA] n | main.rs:146:35:146:35 | n | -| main.rs:146:24:146:24 | n | main.rs:146:24:146:24 | [SSA] n | -| main.rs:146:30:146:36 | sink(...) | main.rs:144:5:147:5 | match s2 { ... } | -| main.rs:153:9:153:10 | [SSA] s1 | main.rs:155:11:155:12 | s1 | -| main.rs:153:9:153:10 | s1 | main.rs:153:9:153:10 | [SSA] s1 | -| main.rs:153:14:153:26 | A(...) | main.rs:153:9:153:10 | s1 | -| main.rs:154:9:154:10 | [SSA] s2 | main.rs:162:11:162:12 | s2 | -| main.rs:154:9:154:10 | s2 | main.rs:154:9:154:10 | [SSA] s2 | -| main.rs:154:14:154:17 | B(...) | main.rs:154:9:154:10 | s2 | -| main.rs:155:11:155:12 | s1 | main.rs:156:9:156:12 | TupleStructPat | -| main.rs:155:11:155:12 | s1 | main.rs:157:9:157:12 | TupleStructPat | -| main.rs:155:11:155:12 | s1 | main.rs:159:11:159:12 | s1 | -| main.rs:156:11:156:11 | [SSA] n | main.rs:156:22:156:22 | n | -| main.rs:156:11:156:11 | n | main.rs:156:11:156:11 | [SSA] n | -| main.rs:156:17:156:23 | sink(...) | main.rs:155:5:158:5 | match s1 { ... } | -| main.rs:157:11:157:11 | [SSA] n | main.rs:157:22:157:22 | n | -| main.rs:157:11:157:11 | n | main.rs:157:11:157:11 | [SSA] n | -| main.rs:157:17:157:23 | sink(...) | main.rs:155:5:158:5 | match s1 { ... } | -| main.rs:159:11:159:12 | s1 | main.rs:160:10:160:20 | ... \| ... | -| main.rs:160:10:160:20 | ... \| ... | main.rs:160:10:160:13 | TupleStructPat | -| main.rs:160:10:160:20 | ... \| ... | main.rs:160:17:160:20 | TupleStructPat | -| main.rs:160:10:160:20 | [SSA] [match(true)] phi | main.rs:160:31:160:31 | n | -| main.rs:160:12:160:12 | [SSA] [input] [match(true)] phi | main.rs:160:10:160:20 | [SSA] [match(true)] phi | -| main.rs:160:12:160:12 | [SSA] n | main.rs:160:12:160:12 | [SSA] [input] [match(true)] phi | -| main.rs:160:12:160:12 | n | main.rs:160:12:160:12 | [SSA] n | -| main.rs:160:19:160:19 | [SSA] [input] [match(true)] phi | main.rs:160:10:160:20 | [SSA] [match(true)] phi | -| main.rs:160:19:160:19 | [SSA] n | main.rs:160:19:160:19 | [SSA] [input] [match(true)] phi | -| main.rs:160:19:160:19 | n | main.rs:160:19:160:19 | [SSA] n | -| main.rs:160:26:160:32 | sink(...) | main.rs:159:5:161:5 | match s1 { ... } | -| main.rs:162:5:165:5 | match s2 { ... } | main.rs:152:50:166:1 | { ... } | -| main.rs:162:11:162:12 | s2 | main.rs:163:9:163:12 | TupleStructPat | -| main.rs:162:11:162:12 | s2 | main.rs:164:9:164:12 | TupleStructPat | -| main.rs:163:11:163:11 | [SSA] n | main.rs:163:22:163:22 | n | -| main.rs:163:11:163:11 | n | main.rs:163:11:163:11 | [SSA] n | -| main.rs:163:17:163:23 | sink(...) | main.rs:162:5:165:5 | match s2 { ... } | -| main.rs:164:11:164:11 | [SSA] n | main.rs:164:22:164:22 | n | -| main.rs:164:11:164:11 | n | main.rs:164:11:164:11 | [SSA] n | -| main.rs:164:17:164:23 | sink(...) | main.rs:162:5:165:5 | match s2 { ... } | -| main.rs:174:9:174:10 | [SSA] s1 | main.rs:178:11:178:12 | s1 | -| main.rs:174:9:174:10 | s1 | main.rs:174:9:174:10 | [SSA] s1 | -| main.rs:174:14:176:5 | ...::C {...} | main.rs:174:9:174:10 | s1 | -| main.rs:177:9:177:10 | [SSA] s2 | main.rs:185:11:185:12 | s2 | -| main.rs:177:9:177:10 | s2 | main.rs:177:9:177:10 | [SSA] s2 | -| main.rs:177:14:177:43 | ...::D {...} | main.rs:177:9:177:10 | s2 | -| main.rs:178:11:178:12 | s1 | main.rs:179:9:179:38 | ...::C {...} | -| main.rs:178:11:178:12 | s1 | main.rs:180:9:180:38 | ...::D {...} | -| main.rs:178:11:178:12 | s1 | main.rs:182:11:182:12 | s1 | -| main.rs:179:36:179:36 | [SSA] n | main.rs:179:48:179:48 | n | -| main.rs:179:36:179:36 | n | main.rs:179:36:179:36 | [SSA] n | -| main.rs:179:43:179:49 | sink(...) | main.rs:178:5:181:5 | match s1 { ... } | -| main.rs:180:36:180:36 | [SSA] n | main.rs:180:48:180:48 | n | -| main.rs:180:36:180:36 | n | main.rs:180:36:180:36 | [SSA] n | -| main.rs:180:43:180:49 | sink(...) | main.rs:178:5:181:5 | match s1 { ... } | -| main.rs:182:11:182:12 | s1 | main.rs:183:10:183:72 | ... \| ... | -| main.rs:183:10:183:72 | ... \| ... | main.rs:183:10:183:39 | ...::C {...} | -| main.rs:183:10:183:72 | ... \| ... | main.rs:183:43:183:72 | ...::D {...} | -| main.rs:183:10:183:72 | [SSA] [match(true)] phi | main.rs:183:83:183:83 | n | -| main.rs:183:37:183:37 | [SSA] [input] [match(true)] phi | main.rs:183:10:183:72 | [SSA] [match(true)] phi | -| main.rs:183:37:183:37 | [SSA] n | main.rs:183:37:183:37 | [SSA] [input] [match(true)] phi | -| main.rs:183:37:183:37 | n | main.rs:183:37:183:37 | [SSA] n | -| main.rs:183:70:183:70 | [SSA] [input] [match(true)] phi | main.rs:183:10:183:72 | [SSA] [match(true)] phi | -| main.rs:183:70:183:70 | [SSA] n | main.rs:183:70:183:70 | [SSA] [input] [match(true)] phi | -| main.rs:183:70:183:70 | n | main.rs:183:70:183:70 | [SSA] n | -| main.rs:183:78:183:84 | sink(...) | main.rs:182:5:184:5 | match s1 { ... } | -| main.rs:185:5:188:5 | match s2 { ... } | main.rs:173:49:189:1 | { ... } | -| main.rs:185:11:185:12 | s2 | main.rs:186:9:186:38 | ...::C {...} | -| main.rs:185:11:185:12 | s2 | main.rs:187:9:187:38 | ...::D {...} | -| main.rs:186:36:186:36 | [SSA] n | main.rs:186:48:186:48 | n | -| main.rs:186:36:186:36 | n | main.rs:186:36:186:36 | [SSA] n | -| main.rs:186:43:186:49 | sink(...) | main.rs:185:5:188:5 | match s2 { ... } | -| main.rs:187:36:187:36 | [SSA] n | main.rs:187:48:187:48 | n | -| main.rs:187:36:187:36 | n | main.rs:187:36:187:36 | [SSA] n | -| main.rs:187:43:187:49 | sink(...) | main.rs:185:5:188:5 | match s2 { ... } | -| main.rs:194:9:194:10 | [SSA] s1 | main.rs:198:11:198:12 | s1 | -| main.rs:194:9:194:10 | s1 | main.rs:194:9:194:10 | [SSA] s1 | -| main.rs:194:14:196:5 | C {...} | main.rs:194:9:194:10 | s1 | -| main.rs:197:9:197:10 | [SSA] s2 | main.rs:205:11:205:12 | s2 | -| main.rs:197:9:197:10 | s2 | main.rs:197:9:197:10 | [SSA] s2 | -| main.rs:197:14:197:29 | D {...} | main.rs:197:9:197:10 | s2 | -| main.rs:198:11:198:12 | s1 | main.rs:199:9:199:24 | C {...} | -| main.rs:198:11:198:12 | s1 | main.rs:200:9:200:24 | D {...} | -| main.rs:198:11:198:12 | s1 | main.rs:202:11:202:12 | s1 | -| main.rs:199:22:199:22 | [SSA] n | main.rs:199:34:199:34 | n | -| main.rs:199:22:199:22 | n | main.rs:199:22:199:22 | [SSA] n | -| main.rs:199:29:199:35 | sink(...) | main.rs:198:5:201:5 | match s1 { ... } | -| main.rs:200:22:200:22 | [SSA] n | main.rs:200:34:200:34 | n | -| main.rs:200:22:200:22 | n | main.rs:200:22:200:22 | [SSA] n | -| main.rs:200:29:200:35 | sink(...) | main.rs:198:5:201:5 | match s1 { ... } | -| main.rs:202:11:202:12 | s1 | main.rs:203:10:203:44 | ... \| ... | -| main.rs:203:10:203:44 | ... \| ... | main.rs:203:10:203:25 | C {...} | -| main.rs:203:10:203:44 | ... \| ... | main.rs:203:29:203:44 | D {...} | -| main.rs:203:10:203:44 | [SSA] [match(true)] phi | main.rs:203:55:203:55 | n | -| main.rs:203:23:203:23 | [SSA] [input] [match(true)] phi | main.rs:203:10:203:44 | [SSA] [match(true)] phi | -| main.rs:203:23:203:23 | [SSA] n | main.rs:203:23:203:23 | [SSA] [input] [match(true)] phi | -| main.rs:203:23:203:23 | n | main.rs:203:23:203:23 | [SSA] n | -| main.rs:203:42:203:42 | [SSA] [input] [match(true)] phi | main.rs:203:10:203:44 | [SSA] [match(true)] phi | -| main.rs:203:42:203:42 | [SSA] n | main.rs:203:42:203:42 | [SSA] [input] [match(true)] phi | -| main.rs:203:42:203:42 | n | main.rs:203:42:203:42 | [SSA] n | -| main.rs:203:50:203:56 | sink(...) | main.rs:202:5:204:5 | match s1 { ... } | -| main.rs:205:5:208:5 | match s2 { ... } | main.rs:193:51:209:1 | { ... } | -| main.rs:205:11:205:12 | s2 | main.rs:206:9:206:24 | C {...} | -| main.rs:205:11:205:12 | s2 | main.rs:207:9:207:24 | D {...} | -| main.rs:206:22:206:22 | [SSA] n | main.rs:206:34:206:34 | n | -| main.rs:206:22:206:22 | n | main.rs:206:22:206:22 | [SSA] n | -| main.rs:206:29:206:35 | sink(...) | main.rs:205:5:208:5 | match s2 { ... } | -| main.rs:207:22:207:22 | [SSA] n | main.rs:207:34:207:34 | n | -| main.rs:207:22:207:22 | n | main.rs:207:22:207:22 | [SSA] n | -| main.rs:207:29:207:35 | sink(...) | main.rs:205:5:208:5 | match s2 { ... } | -| main.rs:212:9:212:9 | [SSA] a | main.rs:213:5:213:5 | a | -| main.rs:212:9:212:9 | a | main.rs:212:9:212:9 | [SSA] a | -| main.rs:212:13:212:17 | { ... } | main.rs:212:9:212:9 | a | -| main.rs:212:15:212:15 | 0 | main.rs:212:13:212:17 | { ... } | -| main.rs:213:5:213:5 | a | main.rs:211:31:214:1 | { ... } | -| main.rs:216:22:216:22 | [SSA] b | main.rs:218:12:218:12 | b | -| main.rs:216:22:216:22 | b | main.rs:216:22:216:22 | [SSA] b | -| main.rs:216:22:216:28 | ...: bool | main.rs:216:22:216:22 | b | -| main.rs:217:9:217:9 | [SSA] a | main.rs:223:5:223:5 | a | +| main.rs:130:9:130:10 | [SSA] s1 | main.rs:131:10:131:11 | s1 | +| main.rs:130:9:130:10 | s1 | main.rs:130:9:130:10 | [SSA] s1 | +| main.rs:130:14:130:29 | Some(...) | main.rs:130:9:130:10 | s1 | +| main.rs:140:9:140:10 | [SSA] s1 | main.rs:142:11:142:12 | s1 | +| main.rs:140:9:140:10 | s1 | main.rs:140:9:140:10 | [SSA] s1 | +| main.rs:140:14:140:39 | ...::A(...) | main.rs:140:9:140:10 | s1 | +| main.rs:141:9:141:10 | [SSA] s2 | main.rs:149:11:149:12 | s2 | +| main.rs:141:9:141:10 | s2 | main.rs:141:9:141:10 | [SSA] s2 | +| main.rs:141:14:141:30 | ...::B(...) | main.rs:141:9:141:10 | s2 | +| main.rs:142:11:142:12 | s1 | main.rs:143:9:143:25 | TupleStructPat | +| main.rs:142:11:142:12 | s1 | main.rs:144:9:144:25 | TupleStructPat | +| main.rs:142:11:142:12 | s1 | main.rs:146:11:146:12 | s1 | +| main.rs:143:24:143:24 | [SSA] n | main.rs:143:35:143:35 | n | +| main.rs:143:24:143:24 | n | main.rs:143:24:143:24 | [SSA] n | +| main.rs:143:30:143:36 | sink(...) | main.rs:142:5:145:5 | match s1 { ... } | +| main.rs:144:24:144:24 | [SSA] n | main.rs:144:35:144:35 | n | +| main.rs:144:24:144:24 | n | main.rs:144:24:144:24 | [SSA] n | +| main.rs:144:30:144:36 | sink(...) | main.rs:142:5:145:5 | match s1 { ... } | +| main.rs:146:11:146:12 | s1 | main.rs:147:10:147:46 | ... \| ... | +| main.rs:147:10:147:46 | ... \| ... | main.rs:147:10:147:26 | TupleStructPat | +| main.rs:147:10:147:46 | ... \| ... | main.rs:147:30:147:46 | TupleStructPat | +| main.rs:147:10:147:46 | [SSA] [match(true)] phi | main.rs:147:57:147:57 | n | +| main.rs:147:25:147:25 | [SSA] [input] [match(true)] phi | main.rs:147:10:147:46 | [SSA] [match(true)] phi | +| main.rs:147:25:147:25 | [SSA] n | main.rs:147:25:147:25 | [SSA] [input] [match(true)] phi | +| main.rs:147:25:147:25 | n | main.rs:147:25:147:25 | [SSA] n | +| main.rs:147:45:147:45 | [SSA] [input] [match(true)] phi | main.rs:147:10:147:46 | [SSA] [match(true)] phi | +| main.rs:147:45:147:45 | [SSA] n | main.rs:147:45:147:45 | [SSA] [input] [match(true)] phi | +| main.rs:147:45:147:45 | n | main.rs:147:45:147:45 | [SSA] n | +| main.rs:147:52:147:58 | sink(...) | main.rs:146:5:148:5 | match s1 { ... } | +| main.rs:149:5:152:5 | match s2 { ... } | main.rs:139:48:153:1 | { ... } | +| main.rs:149:11:149:12 | s2 | main.rs:150:9:150:25 | TupleStructPat | +| main.rs:149:11:149:12 | s2 | main.rs:151:9:151:25 | TupleStructPat | +| main.rs:150:24:150:24 | [SSA] n | main.rs:150:35:150:35 | n | +| main.rs:150:24:150:24 | n | main.rs:150:24:150:24 | [SSA] n | +| main.rs:150:30:150:36 | sink(...) | main.rs:149:5:152:5 | match s2 { ... } | +| main.rs:151:24:151:24 | [SSA] n | main.rs:151:35:151:35 | n | +| main.rs:151:24:151:24 | n | main.rs:151:24:151:24 | [SSA] n | +| main.rs:151:30:151:36 | sink(...) | main.rs:149:5:152:5 | match s2 { ... } | +| main.rs:158:9:158:10 | [SSA] s1 | main.rs:160:11:160:12 | s1 | +| main.rs:158:9:158:10 | s1 | main.rs:158:9:158:10 | [SSA] s1 | +| main.rs:158:14:158:26 | A(...) | main.rs:158:9:158:10 | s1 | +| main.rs:159:9:159:10 | [SSA] s2 | main.rs:167:11:167:12 | s2 | +| main.rs:159:9:159:10 | s2 | main.rs:159:9:159:10 | [SSA] s2 | +| main.rs:159:14:159:17 | B(...) | main.rs:159:9:159:10 | s2 | +| main.rs:160:11:160:12 | s1 | main.rs:161:9:161:12 | TupleStructPat | +| main.rs:160:11:160:12 | s1 | main.rs:162:9:162:12 | TupleStructPat | +| main.rs:160:11:160:12 | s1 | main.rs:164:11:164:12 | s1 | +| main.rs:161:11:161:11 | [SSA] n | main.rs:161:22:161:22 | n | +| main.rs:161:11:161:11 | n | main.rs:161:11:161:11 | [SSA] n | +| main.rs:161:17:161:23 | sink(...) | main.rs:160:5:163:5 | match s1 { ... } | +| main.rs:162:11:162:11 | [SSA] n | main.rs:162:22:162:22 | n | +| main.rs:162:11:162:11 | n | main.rs:162:11:162:11 | [SSA] n | +| main.rs:162:17:162:23 | sink(...) | main.rs:160:5:163:5 | match s1 { ... } | +| main.rs:164:11:164:12 | s1 | main.rs:165:10:165:20 | ... \| ... | +| main.rs:165:10:165:20 | ... \| ... | main.rs:165:10:165:13 | TupleStructPat | +| main.rs:165:10:165:20 | ... \| ... | main.rs:165:17:165:20 | TupleStructPat | +| main.rs:165:10:165:20 | [SSA] [match(true)] phi | main.rs:165:31:165:31 | n | +| main.rs:165:12:165:12 | [SSA] [input] [match(true)] phi | main.rs:165:10:165:20 | [SSA] [match(true)] phi | +| main.rs:165:12:165:12 | [SSA] n | main.rs:165:12:165:12 | [SSA] [input] [match(true)] phi | +| main.rs:165:12:165:12 | n | main.rs:165:12:165:12 | [SSA] n | +| main.rs:165:19:165:19 | [SSA] [input] [match(true)] phi | main.rs:165:10:165:20 | [SSA] [match(true)] phi | +| main.rs:165:19:165:19 | [SSA] n | main.rs:165:19:165:19 | [SSA] [input] [match(true)] phi | +| main.rs:165:19:165:19 | n | main.rs:165:19:165:19 | [SSA] n | +| main.rs:165:26:165:32 | sink(...) | main.rs:164:5:166:5 | match s1 { ... } | +| main.rs:167:5:170:5 | match s2 { ... } | main.rs:157:50:171:1 | { ... } | +| main.rs:167:11:167:12 | s2 | main.rs:168:9:168:12 | TupleStructPat | +| main.rs:167:11:167:12 | s2 | main.rs:169:9:169:12 | TupleStructPat | +| main.rs:168:11:168:11 | [SSA] n | main.rs:168:22:168:22 | n | +| main.rs:168:11:168:11 | n | main.rs:168:11:168:11 | [SSA] n | +| main.rs:168:17:168:23 | sink(...) | main.rs:167:5:170:5 | match s2 { ... } | +| main.rs:169:11:169:11 | [SSA] n | main.rs:169:22:169:22 | n | +| main.rs:169:11:169:11 | n | main.rs:169:11:169:11 | [SSA] n | +| main.rs:169:17:169:23 | sink(...) | main.rs:167:5:170:5 | match s2 { ... } | +| main.rs:179:9:179:10 | [SSA] s1 | main.rs:183:11:183:12 | s1 | +| main.rs:179:9:179:10 | s1 | main.rs:179:9:179:10 | [SSA] s1 | +| main.rs:179:14:181:5 | ...::C {...} | main.rs:179:9:179:10 | s1 | +| main.rs:182:9:182:10 | [SSA] s2 | main.rs:190:11:190:12 | s2 | +| main.rs:182:9:182:10 | s2 | main.rs:182:9:182:10 | [SSA] s2 | +| main.rs:182:14:182:43 | ...::D {...} | main.rs:182:9:182:10 | s2 | +| main.rs:183:11:183:12 | s1 | main.rs:184:9:184:38 | ...::C {...} | +| main.rs:183:11:183:12 | s1 | main.rs:185:9:185:38 | ...::D {...} | +| main.rs:183:11:183:12 | s1 | main.rs:187:11:187:12 | s1 | +| main.rs:184:36:184:36 | [SSA] n | main.rs:184:48:184:48 | n | +| main.rs:184:36:184:36 | n | main.rs:184:36:184:36 | [SSA] n | +| main.rs:184:43:184:49 | sink(...) | main.rs:183:5:186:5 | match s1 { ... } | +| main.rs:185:36:185:36 | [SSA] n | main.rs:185:48:185:48 | n | +| main.rs:185:36:185:36 | n | main.rs:185:36:185:36 | [SSA] n | +| main.rs:185:43:185:49 | sink(...) | main.rs:183:5:186:5 | match s1 { ... } | +| main.rs:187:11:187:12 | s1 | main.rs:188:10:188:72 | ... \| ... | +| main.rs:188:10:188:72 | ... \| ... | main.rs:188:10:188:39 | ...::C {...} | +| main.rs:188:10:188:72 | ... \| ... | main.rs:188:43:188:72 | ...::D {...} | +| main.rs:188:10:188:72 | [SSA] [match(true)] phi | main.rs:188:83:188:83 | n | +| main.rs:188:37:188:37 | [SSA] [input] [match(true)] phi | main.rs:188:10:188:72 | [SSA] [match(true)] phi | +| main.rs:188:37:188:37 | [SSA] n | main.rs:188:37:188:37 | [SSA] [input] [match(true)] phi | +| main.rs:188:37:188:37 | n | main.rs:188:37:188:37 | [SSA] n | +| main.rs:188:70:188:70 | [SSA] [input] [match(true)] phi | main.rs:188:10:188:72 | [SSA] [match(true)] phi | +| main.rs:188:70:188:70 | [SSA] n | main.rs:188:70:188:70 | [SSA] [input] [match(true)] phi | +| main.rs:188:70:188:70 | n | main.rs:188:70:188:70 | [SSA] n | +| main.rs:188:78:188:84 | sink(...) | main.rs:187:5:189:5 | match s1 { ... } | +| main.rs:190:5:193:5 | match s2 { ... } | main.rs:178:49:194:1 | { ... } | +| main.rs:190:11:190:12 | s2 | main.rs:191:9:191:38 | ...::C {...} | +| main.rs:190:11:190:12 | s2 | main.rs:192:9:192:38 | ...::D {...} | +| main.rs:191:36:191:36 | [SSA] n | main.rs:191:48:191:48 | n | +| main.rs:191:36:191:36 | n | main.rs:191:36:191:36 | [SSA] n | +| main.rs:191:43:191:49 | sink(...) | main.rs:190:5:193:5 | match s2 { ... } | +| main.rs:192:36:192:36 | [SSA] n | main.rs:192:48:192:48 | n | +| main.rs:192:36:192:36 | n | main.rs:192:36:192:36 | [SSA] n | +| main.rs:192:43:192:49 | sink(...) | main.rs:190:5:193:5 | match s2 { ... } | +| main.rs:199:9:199:10 | [SSA] s1 | main.rs:203:11:203:12 | s1 | +| main.rs:199:9:199:10 | s1 | main.rs:199:9:199:10 | [SSA] s1 | +| main.rs:199:14:201:5 | C {...} | main.rs:199:9:199:10 | s1 | +| main.rs:202:9:202:10 | [SSA] s2 | main.rs:210:11:210:12 | s2 | +| main.rs:202:9:202:10 | s2 | main.rs:202:9:202:10 | [SSA] s2 | +| main.rs:202:14:202:29 | D {...} | main.rs:202:9:202:10 | s2 | +| main.rs:203:11:203:12 | s1 | main.rs:204:9:204:24 | C {...} | +| main.rs:203:11:203:12 | s1 | main.rs:205:9:205:24 | D {...} | +| main.rs:203:11:203:12 | s1 | main.rs:207:11:207:12 | s1 | +| main.rs:204:22:204:22 | [SSA] n | main.rs:204:34:204:34 | n | +| main.rs:204:22:204:22 | n | main.rs:204:22:204:22 | [SSA] n | +| main.rs:204:29:204:35 | sink(...) | main.rs:203:5:206:5 | match s1 { ... } | +| main.rs:205:22:205:22 | [SSA] n | main.rs:205:34:205:34 | n | +| main.rs:205:22:205:22 | n | main.rs:205:22:205:22 | [SSA] n | +| main.rs:205:29:205:35 | sink(...) | main.rs:203:5:206:5 | match s1 { ... } | +| main.rs:207:11:207:12 | s1 | main.rs:208:10:208:44 | ... \| ... | +| main.rs:208:10:208:44 | ... \| ... | main.rs:208:10:208:25 | C {...} | +| main.rs:208:10:208:44 | ... \| ... | main.rs:208:29:208:44 | D {...} | +| main.rs:208:10:208:44 | [SSA] [match(true)] phi | main.rs:208:55:208:55 | n | +| main.rs:208:23:208:23 | [SSA] [input] [match(true)] phi | main.rs:208:10:208:44 | [SSA] [match(true)] phi | +| main.rs:208:23:208:23 | [SSA] n | main.rs:208:23:208:23 | [SSA] [input] [match(true)] phi | +| main.rs:208:23:208:23 | n | main.rs:208:23:208:23 | [SSA] n | +| main.rs:208:42:208:42 | [SSA] [input] [match(true)] phi | main.rs:208:10:208:44 | [SSA] [match(true)] phi | +| main.rs:208:42:208:42 | [SSA] n | main.rs:208:42:208:42 | [SSA] [input] [match(true)] phi | +| main.rs:208:42:208:42 | n | main.rs:208:42:208:42 | [SSA] n | +| main.rs:208:50:208:56 | sink(...) | main.rs:207:5:209:5 | match s1 { ... } | +| main.rs:210:5:213:5 | match s2 { ... } | main.rs:198:51:214:1 | { ... } | +| main.rs:210:11:210:12 | s2 | main.rs:211:9:211:24 | C {...} | +| main.rs:210:11:210:12 | s2 | main.rs:212:9:212:24 | D {...} | +| main.rs:211:22:211:22 | [SSA] n | main.rs:211:34:211:34 | n | +| main.rs:211:22:211:22 | n | main.rs:211:22:211:22 | [SSA] n | +| main.rs:211:29:211:35 | sink(...) | main.rs:210:5:213:5 | match s2 { ... } | +| main.rs:212:22:212:22 | [SSA] n | main.rs:212:34:212:34 | n | +| main.rs:212:22:212:22 | n | main.rs:212:22:212:22 | [SSA] n | +| main.rs:212:29:212:35 | sink(...) | main.rs:210:5:213:5 | match s2 { ... } | +| main.rs:217:9:217:9 | [SSA] a | main.rs:218:5:218:5 | a | | main.rs:217:9:217:9 | a | main.rs:217:9:217:9 | [SSA] a | -| main.rs:217:13:222:5 | 'block: { ... } | main.rs:217:9:217:9 | a | -| main.rs:219:13:219:26 | break ''block 1 | main.rs:217:13:222:5 | 'block: { ... } | -| main.rs:219:26:219:26 | 1 | main.rs:219:13:219:26 | break ''block 1 | -| main.rs:221:9:221:9 | 2 | main.rs:217:13:222:5 | 'block: { ... } | -| main.rs:223:5:223:5 | a | main.rs:216:38:224:1 | { ... } | -| main.rs:226:22:226:22 | [SSA] b | main.rs:228:12:228:12 | b | -| main.rs:226:22:226:22 | b | main.rs:226:22:226:22 | [SSA] b | -| main.rs:226:22:226:28 | ...: bool | main.rs:226:22:226:22 | b | -| main.rs:227:9:227:9 | [SSA] a | main.rs:233:5:233:5 | a | -| main.rs:227:9:227:9 | a | main.rs:227:9:227:9 | [SSA] a | -| main.rs:227:13:232:5 | 'block: { ... } | main.rs:227:9:227:9 | a | -| main.rs:229:13:229:26 | break ''block 1 | main.rs:227:13:232:5 | 'block: { ... } | -| main.rs:229:26:229:26 | 1 | main.rs:229:13:229:26 | break ''block 1 | -| main.rs:231:9:231:22 | break ''block 2 | main.rs:227:13:232:5 | 'block: { ... } | -| main.rs:231:22:231:22 | 2 | main.rs:231:9:231:22 | break ''block 2 | -| main.rs:233:5:233:5 | a | main.rs:226:38:234:1 | { ... } | +| main.rs:217:13:217:17 | { ... } | main.rs:217:9:217:9 | a | +| main.rs:217:15:217:15 | 0 | main.rs:217:13:217:17 | { ... } | +| main.rs:218:5:218:5 | a | main.rs:216:31:219:1 | { ... } | +| main.rs:221:22:221:22 | [SSA] b | main.rs:223:12:223:12 | b | +| main.rs:221:22:221:22 | b | main.rs:221:22:221:22 | [SSA] b | +| main.rs:221:22:221:28 | ...: bool | main.rs:221:22:221:22 | b | +| main.rs:222:9:222:9 | [SSA] a | main.rs:228:5:228:5 | a | +| main.rs:222:9:222:9 | a | main.rs:222:9:222:9 | [SSA] a | +| main.rs:222:13:227:5 | 'block: { ... } | main.rs:222:9:222:9 | a | +| main.rs:224:13:224:26 | break ''block 1 | main.rs:222:13:227:5 | 'block: { ... } | +| main.rs:224:26:224:26 | 1 | main.rs:224:13:224:26 | break ''block 1 | +| main.rs:226:9:226:9 | 2 | main.rs:222:13:227:5 | 'block: { ... } | +| main.rs:228:5:228:5 | a | main.rs:221:38:229:1 | { ... } | +| main.rs:231:22:231:22 | [SSA] b | main.rs:233:12:233:12 | b | +| main.rs:231:22:231:22 | b | main.rs:231:22:231:22 | [SSA] b | +| main.rs:231:22:231:28 | ...: bool | main.rs:231:22:231:22 | b | +| main.rs:232:9:232:9 | [SSA] a | main.rs:238:5:238:5 | a | +| main.rs:232:9:232:9 | a | main.rs:232:9:232:9 | [SSA] a | +| main.rs:232:13:237:5 | 'block: { ... } | main.rs:232:9:232:9 | a | +| main.rs:234:13:234:26 | break ''block 1 | main.rs:232:13:237:5 | 'block: { ... } | +| main.rs:234:26:234:26 | 1 | main.rs:234:13:234:26 | break ''block 1 | +| main.rs:236:9:236:22 | break ''block 2 | main.rs:232:13:237:5 | 'block: { ... } | +| main.rs:236:22:236:22 | 2 | main.rs:236:9:236:22 | break ''block 2 | +| main.rs:238:5:238:5 | a | main.rs:231:38:239:1 | { ... } | storeStep | main.rs:117:19:117:28 | source(...) | Some | main.rs:117:14:117:29 | Some(...) | | main.rs:118:19:118:19 | 2 | Some | main.rs:118:14:118:20 | Some(...) | -| main.rs:135:29:135:38 | source(...) | A | main.rs:135:14:135:39 | ...::A(...) | -| main.rs:136:29:136:29 | 2 | B | main.rs:136:14:136:30 | ...::B(...) | -| main.rs:175:18:175:27 | source(...) | C | main.rs:174:14:176:5 | ...::C {...} | -| main.rs:177:41:177:41 | 2 | D | main.rs:177:14:177:43 | ...::D {...} | -| main.rs:240:27:240:27 | 0 | Some | main.rs:240:22:240:28 | Some(...) | +| main.rs:130:19:130:28 | source(...) | Some | main.rs:130:14:130:29 | Some(...) | +| main.rs:140:29:140:38 | source(...) | A | main.rs:140:14:140:39 | ...::A(...) | +| main.rs:141:29:141:29 | 2 | B | main.rs:141:14:141:30 | ...::B(...) | +| main.rs:180:18:180:27 | source(...) | C | main.rs:179:14:181:5 | ...::C {...} | +| main.rs:182:41:182:41 | 2 | D | main.rs:182:14:182:43 | ...::D {...} | +| main.rs:245:27:245:27 | 0 | Some | main.rs:245:22:245:28 | Some(...) | readStep +| file://:0:0:0:0 | [summary param] self in lang:core::_::::unwrap | Some | file://:0:0:0:0 | [summary] read: Argument[self].Variant[crate::std::option::Option::Some(0)] in lang:core::_::::unwrap | | main.rs:33:9:33:15 | TupleStructPat | Some | main.rs:33:14:33:14 | _ | | main.rs:120:9:120:15 | TupleStructPat | Some | main.rs:120:14:120:14 | n | | main.rs:124:9:124:15 | TupleStructPat | Some | main.rs:124:14:124:14 | n | -| main.rs:138:9:138:25 | TupleStructPat | A | main.rs:138:24:138:24 | n | -| main.rs:139:9:139:25 | TupleStructPat | B | main.rs:139:24:139:24 | n | -| main.rs:142:10:142:26 | TupleStructPat | A | main.rs:142:25:142:25 | n | -| main.rs:142:30:142:46 | TupleStructPat | B | main.rs:142:45:142:45 | n | -| main.rs:145:9:145:25 | TupleStructPat | A | main.rs:145:24:145:24 | n | -| main.rs:146:9:146:25 | TupleStructPat | B | main.rs:146:24:146:24 | n | -| main.rs:179:9:179:38 | ...::C {...} | C | main.rs:179:36:179:36 | n | -| main.rs:180:9:180:38 | ...::D {...} | D | main.rs:180:36:180:36 | n | -| main.rs:183:10:183:39 | ...::C {...} | C | main.rs:183:37:183:37 | n | -| main.rs:183:43:183:72 | ...::D {...} | D | main.rs:183:70:183:70 | n | -| main.rs:186:9:186:38 | ...::C {...} | C | main.rs:186:36:186:36 | n | -| main.rs:187:9:187:38 | ...::D {...} | D | main.rs:187:36:187:36 | n | +| main.rs:143:9:143:25 | TupleStructPat | A | main.rs:143:24:143:24 | n | +| main.rs:144:9:144:25 | TupleStructPat | B | main.rs:144:24:144:24 | n | +| main.rs:147:10:147:26 | TupleStructPat | A | main.rs:147:25:147:25 | n | +| main.rs:147:30:147:46 | TupleStructPat | B | main.rs:147:45:147:45 | n | +| main.rs:150:9:150:25 | TupleStructPat | A | main.rs:150:24:150:24 | n | +| main.rs:151:9:151:25 | TupleStructPat | B | main.rs:151:24:151:24 | n | +| main.rs:184:9:184:38 | ...::C {...} | C | main.rs:184:36:184:36 | n | +| main.rs:185:9:185:38 | ...::D {...} | D | main.rs:185:36:185:36 | n | +| main.rs:188:10:188:39 | ...::C {...} | C | main.rs:188:37:188:37 | n | +| main.rs:188:43:188:72 | ...::D {...} | D | main.rs:188:70:188:70 | n | +| main.rs:191:9:191:38 | ...::C {...} | C | main.rs:191:36:191:36 | n | +| main.rs:192:9:192:38 | ...::D {...} | D | main.rs:192:36:192:36 | n | diff --git a/rust/ql/test/library-tests/dataflow/local/inline-flow.expected b/rust/ql/test/library-tests/dataflow/local/inline-flow.expected index bfafa38c3ff3..990e9e4a7453 100644 --- a/rust/ql/test/library-tests/dataflow/local/inline-flow.expected +++ b/rust/ql/test/library-tests/dataflow/local/inline-flow.expected @@ -9,20 +9,23 @@ edges | main.rs:117:19:117:28 | source(...) | main.rs:117:14:117:29 | Some(...) [Some] | provenance | | | main.rs:120:9:120:15 | TupleStructPat [Some] | main.rs:120:14:120:14 | n | provenance | | | main.rs:120:14:120:14 | n | main.rs:120:25:120:25 | n | provenance | | -| main.rs:135:14:135:39 | ...::A(...) [A] | main.rs:138:9:138:25 | TupleStructPat [A] | provenance | | -| main.rs:135:14:135:39 | ...::A(...) [A] | main.rs:142:10:142:26 | TupleStructPat [A] | provenance | | -| main.rs:135:29:135:38 | source(...) | main.rs:135:14:135:39 | ...::A(...) [A] | provenance | | -| main.rs:138:9:138:25 | TupleStructPat [A] | main.rs:138:24:138:24 | n | provenance | | -| main.rs:138:24:138:24 | n | main.rs:138:35:138:35 | n | provenance | | -| main.rs:142:10:142:26 | TupleStructPat [A] | main.rs:142:25:142:25 | n | provenance | | -| main.rs:142:25:142:25 | n | main.rs:142:57:142:57 | n | provenance | | -| main.rs:174:14:176:5 | ...::C {...} [C] | main.rs:179:9:179:38 | ...::C {...} [C] | provenance | | -| main.rs:174:14:176:5 | ...::C {...} [C] | main.rs:183:10:183:39 | ...::C {...} [C] | provenance | | -| main.rs:175:18:175:27 | source(...) | main.rs:174:14:176:5 | ...::C {...} [C] | provenance | | -| main.rs:179:9:179:38 | ...::C {...} [C] | main.rs:179:36:179:36 | n | provenance | | -| main.rs:179:36:179:36 | n | main.rs:179:48:179:48 | n | provenance | | -| main.rs:183:10:183:39 | ...::C {...} [C] | main.rs:183:37:183:37 | n | provenance | | -| main.rs:183:37:183:37 | n | main.rs:183:83:183:83 | n | provenance | | +| main.rs:130:14:130:29 | Some(...) [Some] | main.rs:131:10:131:11 | s1 [Some] | provenance | | +| main.rs:130:19:130:28 | source(...) | main.rs:130:14:130:29 | Some(...) [Some] | provenance | | +| main.rs:131:10:131:11 | s1 [Some] | main.rs:131:10:131:20 | ... .unwrap(...) | provenance | | +| main.rs:140:14:140:39 | ...::A(...) [A] | main.rs:143:9:143:25 | TupleStructPat [A] | provenance | | +| main.rs:140:14:140:39 | ...::A(...) [A] | main.rs:147:10:147:26 | TupleStructPat [A] | provenance | | +| main.rs:140:29:140:38 | source(...) | main.rs:140:14:140:39 | ...::A(...) [A] | provenance | | +| main.rs:143:9:143:25 | TupleStructPat [A] | main.rs:143:24:143:24 | n | provenance | | +| main.rs:143:24:143:24 | n | main.rs:143:35:143:35 | n | provenance | | +| main.rs:147:10:147:26 | TupleStructPat [A] | main.rs:147:25:147:25 | n | provenance | | +| main.rs:147:25:147:25 | n | main.rs:147:57:147:57 | n | provenance | | +| main.rs:179:14:181:5 | ...::C {...} [C] | main.rs:184:9:184:38 | ...::C {...} [C] | provenance | | +| main.rs:179:14:181:5 | ...::C {...} [C] | main.rs:188:10:188:39 | ...::C {...} [C] | provenance | | +| main.rs:180:18:180:27 | source(...) | main.rs:179:14:181:5 | ...::C {...} [C] | provenance | | +| main.rs:184:9:184:38 | ...::C {...} [C] | main.rs:184:36:184:36 | n | provenance | | +| main.rs:184:36:184:36 | n | main.rs:184:48:184:48 | n | provenance | | +| main.rs:188:10:188:39 | ...::C {...} [C] | main.rs:188:37:188:37 | n | provenance | | +| main.rs:188:37:188:37 | n | main.rs:188:83:188:83 | n | provenance | | nodes | main.rs:15:10:15:18 | source(...) | semmle.label | source(...) | | main.rs:19:13:19:21 | source(...) | semmle.label | source(...) | @@ -40,22 +43,26 @@ nodes | main.rs:120:9:120:15 | TupleStructPat [Some] | semmle.label | TupleStructPat [Some] | | main.rs:120:14:120:14 | n | semmle.label | n | | main.rs:120:25:120:25 | n | semmle.label | n | -| main.rs:135:14:135:39 | ...::A(...) [A] | semmle.label | ...::A(...) [A] | -| main.rs:135:29:135:38 | source(...) | semmle.label | source(...) | -| main.rs:138:9:138:25 | TupleStructPat [A] | semmle.label | TupleStructPat [A] | -| main.rs:138:24:138:24 | n | semmle.label | n | -| main.rs:138:35:138:35 | n | semmle.label | n | -| main.rs:142:10:142:26 | TupleStructPat [A] | semmle.label | TupleStructPat [A] | -| main.rs:142:25:142:25 | n | semmle.label | n | -| main.rs:142:57:142:57 | n | semmle.label | n | -| main.rs:174:14:176:5 | ...::C {...} [C] | semmle.label | ...::C {...} [C] | -| main.rs:175:18:175:27 | source(...) | semmle.label | source(...) | -| main.rs:179:9:179:38 | ...::C {...} [C] | semmle.label | ...::C {...} [C] | -| main.rs:179:36:179:36 | n | semmle.label | n | -| main.rs:179:48:179:48 | n | semmle.label | n | -| main.rs:183:10:183:39 | ...::C {...} [C] | semmle.label | ...::C {...} [C] | -| main.rs:183:37:183:37 | n | semmle.label | n | -| main.rs:183:83:183:83 | n | semmle.label | n | +| main.rs:130:14:130:29 | Some(...) [Some] | semmle.label | Some(...) [Some] | +| main.rs:130:19:130:28 | source(...) | semmle.label | source(...) | +| main.rs:131:10:131:11 | s1 [Some] | semmle.label | s1 [Some] | +| main.rs:131:10:131:20 | ... .unwrap(...) | semmle.label | ... .unwrap(...) | +| main.rs:140:14:140:39 | ...::A(...) [A] | semmle.label | ...::A(...) [A] | +| main.rs:140:29:140:38 | source(...) | semmle.label | source(...) | +| main.rs:143:9:143:25 | TupleStructPat [A] | semmle.label | TupleStructPat [A] | +| main.rs:143:24:143:24 | n | semmle.label | n | +| main.rs:143:35:143:35 | n | semmle.label | n | +| main.rs:147:10:147:26 | TupleStructPat [A] | semmle.label | TupleStructPat [A] | +| main.rs:147:25:147:25 | n | semmle.label | n | +| main.rs:147:57:147:57 | n | semmle.label | n | +| main.rs:179:14:181:5 | ...::C {...} [C] | semmle.label | ...::C {...} [C] | +| main.rs:180:18:180:27 | source(...) | semmle.label | source(...) | +| main.rs:184:9:184:38 | ...::C {...} [C] | semmle.label | ...::C {...} [C] | +| main.rs:184:36:184:36 | n | semmle.label | n | +| main.rs:184:48:184:48 | n | semmle.label | n | +| main.rs:188:10:188:39 | ...::C {...} [C] | semmle.label | ...::C {...} [C] | +| main.rs:188:37:188:37 | n | semmle.label | n | +| main.rs:188:83:188:83 | n | semmle.label | n | subpaths testFailures #select @@ -66,7 +73,8 @@ testFailures | main.rs:47:10:47:10 | b | main.rs:45:15:45:23 | source(...) | main.rs:47:10:47:10 | b | $@ | main.rs:45:15:45:23 | source(...) | source(...) | | main.rs:54:10:54:10 | i | main.rs:53:9:53:17 | source(...) | main.rs:54:10:54:10 | i | $@ | main.rs:53:9:53:17 | source(...) | source(...) | | main.rs:120:25:120:25 | n | main.rs:117:19:117:28 | source(...) | main.rs:120:25:120:25 | n | $@ | main.rs:117:19:117:28 | source(...) | source(...) | -| main.rs:138:35:138:35 | n | main.rs:135:29:135:38 | source(...) | main.rs:138:35:138:35 | n | $@ | main.rs:135:29:135:38 | source(...) | source(...) | -| main.rs:142:57:142:57 | n | main.rs:135:29:135:38 | source(...) | main.rs:142:57:142:57 | n | $@ | main.rs:135:29:135:38 | source(...) | source(...) | -| main.rs:179:48:179:48 | n | main.rs:175:18:175:27 | source(...) | main.rs:179:48:179:48 | n | $@ | main.rs:175:18:175:27 | source(...) | source(...) | -| main.rs:183:83:183:83 | n | main.rs:175:18:175:27 | source(...) | main.rs:183:83:183:83 | n | $@ | main.rs:175:18:175:27 | source(...) | source(...) | +| main.rs:131:10:131:20 | ... .unwrap(...) | main.rs:130:19:130:28 | source(...) | main.rs:131:10:131:20 | ... .unwrap(...) | $@ | main.rs:130:19:130:28 | source(...) | source(...) | +| main.rs:143:35:143:35 | n | main.rs:140:29:140:38 | source(...) | main.rs:143:35:143:35 | n | $@ | main.rs:140:29:140:38 | source(...) | source(...) | +| main.rs:147:57:147:57 | n | main.rs:140:29:140:38 | source(...) | main.rs:147:57:147:57 | n | $@ | main.rs:140:29:140:38 | source(...) | source(...) | +| main.rs:184:48:184:48 | n | main.rs:180:18:180:27 | source(...) | main.rs:184:48:184:48 | n | $@ | main.rs:180:18:180:27 | source(...) | source(...) | +| main.rs:188:83:188:83 | n | main.rs:180:18:180:27 | source(...) | main.rs:188:83:188:83 | n | $@ | main.rs:180:18:180:27 | source(...) | source(...) | diff --git a/rust/ql/test/library-tests/dataflow/local/main.rs b/rust/ql/test/library-tests/dataflow/local/main.rs index 9a9e6b467e0e..9c9d0c811a3c 100644 --- a/rust/ql/test/library-tests/dataflow/local/main.rs +++ b/rust/ql/test/library-tests/dataflow/local/main.rs @@ -126,6 +126,11 @@ fn option_pattern_match_unqualified() { } } +fn option_unwrap() { + let s1 = Some(source(19)); + sink(s1.unwrap()); // $ hasValueFlow=19 +} + enum MyTupleEnum { A(i64), B(i64), @@ -246,6 +251,7 @@ fn main() { struct_pattern_match(); option_pattern_match_qualified(); option_pattern_match_unqualified(); + option_unwrap(); custom_tuple_enum_pattern_match_qualified(); custom_tuple_enum_pattern_match_unqualified(); custom_record_enum_pattern_match_qualified();