Skip to content

Commit ff80b24

Browse files
authored
Merge pull request github#17917 from paldepind/rust-df-types
Rust: Fix unique type data flow inconsistency
2 parents 4df4a1e + 60986d8 commit ff80b24

File tree

14 files changed

+3
-122
lines changed

14 files changed

+3
-122
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ module RustDataFlow implements InputSig<Location> {
223223

224224
DataFlowCallable nodeGetEnclosingCallable(Node node) { none() }
225225

226-
DataFlowType getNodeType(Node node) { none() }
226+
DataFlowType getNodeType(Node node) { any() }
227227

228228
predicate nodeIsHidden(Node node) { none() }
229229

@@ -253,6 +253,8 @@ module RustDataFlow implements InputSig<Location> {
253253

254254
OutNode getAnOutNode(DataFlowCall call, ReturnKind kind) { none() }
255255

256+
// NOTE: For now we use the type `Unit` and do not benefit from type
257+
// information in the data flow analysis.
256258
final class DataFlowType = Unit;
257259

258260
predicate compatibleTypes(DataFlowType t1, DataFlowType t2) { any() }

rust/ql/test/extractor-tests/generated/BecomeExpr/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ uniqueEnclosingCallable
33
| gen_become_expr.rs:4:19:4:24 | Param | Node should have one enclosing callable but has 0. |
44
uniqueCallEnclosingCallable
55
| gen_become_expr.rs:8:17:8:36 | CallExpr | Call should have one enclosing callable but has 0. |
6-
uniqueType
7-
| gen_become_expr.rs:4:11:4:16 | Param | Node should have one type but has 0. |
8-
| gen_become_expr.rs:4:19:4:24 | Param | Node should have one type but has 0. |

rust/ql/test/extractor-tests/generated/ClosureExpr/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@ uniqueEnclosingCallable
55
| gen_closure_expr.rs:7:20:7:20 | Param | Node should have one enclosing callable but has 0. |
66
| gen_closure_expr.rs:9:6:9:6 | Param | Node should have one enclosing callable but has 0. |
77
| gen_closure_expr.rs:11:14:11:14 | Param | Node should have one enclosing callable but has 0. |
8-
uniqueType
9-
| gen_closure_expr.rs:5:6:5:6 | Param | Node should have one type but has 0. |
10-
| gen_closure_expr.rs:6:11:6:16 | Param | Node should have one type but has 0. |
11-
| gen_closure_expr.rs:7:12:7:17 | Param | Node should have one type but has 0. |
12-
| gen_closure_expr.rs:7:20:7:20 | Param | Node should have one type but has 0. |
13-
| gen_closure_expr.rs:9:6:9:6 | Param | Node should have one type but has 0. |
14-
| gen_closure_expr.rs:11:14:11:14 | Param | Node should have one type but has 0. |
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
uniqueEnclosingCallable
22
| gen_function.rs:4:8:4:13 | Param | Node should have one enclosing callable but has 0. |
3-
uniqueType
4-
| gen_function.rs:4:8:4:13 | Param | Node should have one type but has 0. |

rust/ql/test/extractor-tests/generated/LetExpr/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,3 @@ uniqueEnclosingCallable
22
| gen_let_expr.rs:3:18:3:43 | Param | Node should have one enclosing callable but has 0. |
33
uniqueCallEnclosingCallable
44
| gen_let_expr.rs:6:18:6:24 | CallExpr | Call should have one enclosing callable but has 0. |
5-
uniqueType
6-
| gen_let_expr.rs:3:18:3:43 | Param | Node should have one type but has 0. |

rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
uniqueEnclosingCallable
22
| common_definitions.rs:3:15:3:25 | Param | Node should have one enclosing callable but has 0. |
33
| file://:0:0:0:0 | Param | Node should have one enclosing callable but has 0. |
4-
uniqueType
5-
| common_definitions.rs:3:15:3:25 | Param | Node should have one type but has 0. |
6-
| file://:0:0:0:0 | Param | Node should have one type but has 0. |
74
uniqueNodeLocation
85
| file://:0:0:0:0 | BlockExpr | Node should have one location but has 0. |
96
| file://:0:0:0:0 | MethodCallExpr | Node should have one location but has 0. |
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
uniqueEnclosingCallable
22
| gen_match_arm.rs:3:19:3:24 | Param | Node should have one enclosing callable but has 0. |
3-
uniqueType
4-
| gen_match_arm.rs:3:19:3:24 | Param | Node should have one type but has 0. |
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
uniqueEnclosingCallable
22
| gen_match_expr.rs:3:20:3:25 | Param | Node should have one enclosing callable but has 0. |
3-
uniqueType
4-
| gen_match_expr.rs:3:20:3:25 | Param | Node should have one type but has 0. |
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
uniqueEnclosingCallable
22
| gen_trait.rs:7:32:7:60 | Param | Node should have one enclosing callable but has 0. |
3-
uniqueType
4-
| gen_trait.rs:7:32:7:60 | Param | Node should have one type but has 0. |

rust/ql/test/library-tests/controlflow/CONSISTENCY/DataFlowConsistency.expected

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -63,52 +63,3 @@ uniqueCallEnclosingCallable
6363
| test.rs:381:12:381:30 | CallExpr | Call should have one enclosing callable but has 0. |
6464
| test.rs:384:9:384:23 | CallExpr | Call should have one enclosing callable but has 0. |
6565
| test.rs:404:5:404:18 | CallExpr | Call should have one enclosing callable but has 0. |
66-
uniqueType
67-
| test.rs:18:32:18:37 | Param | Node should have one type but has 0. |
68-
| test.rs:36:31:36:37 | Param | Node should have one type but has 0. |
69-
| test.rs:50:34:50:40 | Param | Node should have one type but has 0. |
70-
| test.rs:64:34:64:40 | Param | Node should have one type but has 0. |
71-
| test.rs:78:19:78:24 | Param | Node should have one type but has 0. |
72-
| test.rs:98:17:98:22 | Param | Node should have one type but has 0. |
73-
| test.rs:114:25:114:30 | Param | Node should have one type but has 0. |
74-
| test.rs:115:20:115:20 | Param | Node should have one type but has 0. |
75-
| test.rs:121:21:121:26 | Param | Node should have one type but has 0. |
76-
| test.rs:129:25:129:38 | Param | Node should have one type but has 0. |
77-
| test.rs:137:20:137:33 | Param | Node should have one type but has 0. |
78-
| test.rs:144:23:144:28 | Param | Node should have one type but has 0. |
79-
| test.rs:152:29:152:34 | Param | Node should have one type but has 0. |
80-
| test.rs:163:29:163:34 | Param | Node should have one type but has 0. |
81-
| test.rs:174:27:174:32 | Param | Node should have one type but has 0. |
82-
| test.rs:183:22:183:27 | Param | Node should have one type but has 0. |
83-
| test.rs:196:22:196:27 | Param | Node should have one type but has 0. |
84-
| test.rs:209:28:209:33 | Param | Node should have one type but has 0. |
85-
| test.rs:222:26:222:32 | Param | Node should have one type but has 0. |
86-
| test.rs:222:35:222:41 | Param | Node should have one type but has 0. |
87-
| test.rs:222:44:222:50 | Param | Node should have one type but has 0. |
88-
| test.rs:227:25:227:31 | Param | Node should have one type but has 0. |
89-
| test.rs:227:34:227:40 | Param | Node should have one type but has 0. |
90-
| test.rs:227:43:227:49 | Param | Node should have one type but has 0. |
91-
| test.rs:232:27:232:33 | Param | Node should have one type but has 0. |
92-
| test.rs:232:36:232:41 | Param | Node should have one type but has 0. |
93-
| test.rs:232:44:232:50 | Param | Node should have one type but has 0. |
94-
| test.rs:237:26:237:32 | Param | Node should have one type but has 0. |
95-
| test.rs:242:29:242:35 | Param | Node should have one type but has 0. |
96-
| test.rs:242:38:242:43 | Param | Node should have one type but has 0. |
97-
| test.rs:242:46:242:52 | Param | Node should have one type but has 0. |
98-
| test.rs:250:28:250:34 | Param | Node should have one type but has 0. |
99-
| test.rs:250:37:250:42 | Param | Node should have one type but has 0. |
100-
| test.rs:250:45:250:51 | Param | Node should have one type but has 0. |
101-
| test.rs:258:29:258:35 | Param | Node should have one type but has 0. |
102-
| test.rs:269:38:269:44 | Param | Node should have one type but has 0. |
103-
| test.rs:273:38:273:52 | Param | Node should have one type but has 0. |
104-
| test.rs:283:19:283:42 | Param | Node should have one type but has 0. |
105-
| test.rs:291:44:291:67 | Param | Node should have one type but has 0. |
106-
| test.rs:302:23:302:32 | Param | Node should have one type but has 0. |
107-
| test.rs:302:35:302:48 | Param | Node should have one type but has 0. |
108-
| test.rs:309:35:309:58 | Param | Node should have one type but has 0. |
109-
| test.rs:319:23:319:36 | Param | Node should have one type but has 0. |
110-
| test.rs:324:29:324:42 | Param | Node should have one type but has 0. |
111-
| test.rs:335:28:335:35 | Param | Node should have one type but has 0. |
112-
| test.rs:342:29:342:40 | Param | Node should have one type but has 0. |
113-
| test.rs:401:15:401:25 | Param | Node should have one type but has 0. |
114-
| test.rs:408:16:408:19 | Param | Node should have one type but has 0. |

0 commit comments

Comments
 (0)