Skip to content

Commit

Permalink
Rust: Fix unique type data flow inconsistency
Browse files Browse the repository at this point in the history
  • Loading branch information
paldepind committed Nov 6, 2024
1 parent 6054855 commit 60986d8
Show file tree
Hide file tree
Showing 14 changed files with 3 additions and 122 deletions.
4 changes: 3 additions & 1 deletion rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ module RustDataFlow implements InputSig<Location> {

DataFlowCallable nodeGetEnclosingCallable(Node node) { none() }

DataFlowType getNodeType(Node node) { none() }
DataFlowType getNodeType(Node node) { any() }

predicate nodeIsHidden(Node node) { none() }

Expand Down Expand Up @@ -253,6 +253,8 @@ module RustDataFlow implements InputSig<Location> {

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

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

predicate compatibleTypes(DataFlowType t1, DataFlowType t2) { any() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ uniqueEnclosingCallable
| gen_become_expr.rs:4:19:4:24 | Param | Node should have one enclosing callable but has 0. |
uniqueCallEnclosingCallable
| gen_become_expr.rs:8:17:8:36 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| gen_become_expr.rs:4:11:4:16 | Param | Node should have one type but has 0. |
| gen_become_expr.rs:4:19:4:24 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,3 @@ uniqueEnclosingCallable
| gen_closure_expr.rs:7:20:7:20 | Param | Node should have one enclosing callable but has 0. |
| gen_closure_expr.rs:9:6:9:6 | Param | Node should have one enclosing callable but has 0. |
| gen_closure_expr.rs:11:14:11:14 | Param | Node should have one enclosing callable but has 0. |
uniqueType
| gen_closure_expr.rs:5:6:5:6 | Param | Node should have one type but has 0. |
| gen_closure_expr.rs:6:11:6:16 | Param | Node should have one type but has 0. |
| gen_closure_expr.rs:7:12:7:17 | Param | Node should have one type but has 0. |
| gen_closure_expr.rs:7:20:7:20 | Param | Node should have one type but has 0. |
| gen_closure_expr.rs:9:6:9:6 | Param | Node should have one type but has 0. |
| gen_closure_expr.rs:11:14:11:14 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
uniqueEnclosingCallable
| gen_function.rs:4:8:4:13 | Param | Node should have one enclosing callable but has 0. |
uniqueType
| gen_function.rs:4:8:4:13 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ uniqueEnclosingCallable
| gen_let_expr.rs:3:18:3:43 | Param | Node should have one enclosing callable but has 0. |
uniqueCallEnclosingCallable
| gen_let_expr.rs:6:18:6:24 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| gen_let_expr.rs:3:18:3:43 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
uniqueEnclosingCallable
| common_definitions.rs:3:15:3:25 | Param | Node should have one enclosing callable but has 0. |
| file://:0:0:0:0 | Param | Node should have one enclosing callable but has 0. |
uniqueType
| common_definitions.rs:3:15:3:25 | Param | Node should have one type but has 0. |
| file://:0:0:0:0 | Param | Node should have one type but has 0. |
uniqueNodeLocation
| file://:0:0:0:0 | BlockExpr | Node should have one location but has 0. |
| file://:0:0:0:0 | MethodCallExpr | Node should have one location but has 0. |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
uniqueEnclosingCallable
| gen_match_arm.rs:3:19:3:24 | Param | Node should have one enclosing callable but has 0. |
uniqueType
| gen_match_arm.rs:3:19:3:24 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
uniqueEnclosingCallable
| gen_match_expr.rs:3:20:3:25 | Param | Node should have one enclosing callable but has 0. |
uniqueType
| gen_match_expr.rs:3:20:3:25 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
uniqueEnclosingCallable
| gen_trait.rs:7:32:7:60 | Param | Node should have one enclosing callable but has 0. |
uniqueType
| gen_trait.rs:7:32:7:60 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -63,52 +63,3 @@ uniqueCallEnclosingCallable
| test.rs:381:12:381:30 | CallExpr | Call should have one enclosing callable but has 0. |
| test.rs:384:9:384:23 | CallExpr | Call should have one enclosing callable but has 0. |
| test.rs:404:5:404:18 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| test.rs:18:32:18:37 | Param | Node should have one type but has 0. |
| test.rs:36:31:36:37 | Param | Node should have one type but has 0. |
| test.rs:50:34:50:40 | Param | Node should have one type but has 0. |
| test.rs:64:34:64:40 | Param | Node should have one type but has 0. |
| test.rs:78:19:78:24 | Param | Node should have one type but has 0. |
| test.rs:98:17:98:22 | Param | Node should have one type but has 0. |
| test.rs:114:25:114:30 | Param | Node should have one type but has 0. |
| test.rs:115:20:115:20 | Param | Node should have one type but has 0. |
| test.rs:121:21:121:26 | Param | Node should have one type but has 0. |
| test.rs:129:25:129:38 | Param | Node should have one type but has 0. |
| test.rs:137:20:137:33 | Param | Node should have one type but has 0. |
| test.rs:144:23:144:28 | Param | Node should have one type but has 0. |
| test.rs:152:29:152:34 | Param | Node should have one type but has 0. |
| test.rs:163:29:163:34 | Param | Node should have one type but has 0. |
| test.rs:174:27:174:32 | Param | Node should have one type but has 0. |
| test.rs:183:22:183:27 | Param | Node should have one type but has 0. |
| test.rs:196:22:196:27 | Param | Node should have one type but has 0. |
| test.rs:209:28:209:33 | Param | Node should have one type but has 0. |
| test.rs:222:26:222:32 | Param | Node should have one type but has 0. |
| test.rs:222:35:222:41 | Param | Node should have one type but has 0. |
| test.rs:222:44:222:50 | Param | Node should have one type but has 0. |
| test.rs:227:25:227:31 | Param | Node should have one type but has 0. |
| test.rs:227:34:227:40 | Param | Node should have one type but has 0. |
| test.rs:227:43:227:49 | Param | Node should have one type but has 0. |
| test.rs:232:27:232:33 | Param | Node should have one type but has 0. |
| test.rs:232:36:232:41 | Param | Node should have one type but has 0. |
| test.rs:232:44:232:50 | Param | Node should have one type but has 0. |
| test.rs:237:26:237:32 | Param | Node should have one type but has 0. |
| test.rs:242:29:242:35 | Param | Node should have one type but has 0. |
| test.rs:242:38:242:43 | Param | Node should have one type but has 0. |
| test.rs:242:46:242:52 | Param | Node should have one type but has 0. |
| test.rs:250:28:250:34 | Param | Node should have one type but has 0. |
| test.rs:250:37:250:42 | Param | Node should have one type but has 0. |
| test.rs:250:45:250:51 | Param | Node should have one type but has 0. |
| test.rs:258:29:258:35 | Param | Node should have one type but has 0. |
| test.rs:269:38:269:44 | Param | Node should have one type but has 0. |
| test.rs:273:38:273:52 | Param | Node should have one type but has 0. |
| test.rs:283:19:283:42 | Param | Node should have one type but has 0. |
| test.rs:291:44:291:67 | Param | Node should have one type but has 0. |
| test.rs:302:23:302:32 | Param | Node should have one type but has 0. |
| test.rs:302:35:302:48 | Param | Node should have one type but has 0. |
| test.rs:309:35:309:58 | Param | Node should have one type but has 0. |
| test.rs:319:23:319:36 | Param | Node should have one type but has 0. |
| test.rs:324:29:324:42 | Param | Node should have one type but has 0. |
| test.rs:335:28:335:35 | Param | Node should have one type but has 0. |
| test.rs:342:29:342:40 | Param | Node should have one type but has 0. |
| test.rs:401:15:401:25 | Param | Node should have one type but has 0. |
| test.rs:408:16:408:19 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ uniqueCallEnclosingCallable
| main.rs:24:5:24:11 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:28:13:28:20 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:29:5:29:11 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| main.rs:5:9:5:15 | Param | Node should have one type but has 0. |
| main.rs:9:13:9:19 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,3 @@ uniqueCallEnclosingCallable
| main.rs:3:14:3:33 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:39:5:39:14 | CallExpr | Call should have one enclosing callable but has 0. |
| main.rs:40:5:40:23 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| main.rs:6:18:6:27 | Param | Node should have one type but has 0. |
| main.rs:31:21:31:26 | Param | Node should have one type but has 0. |
| main.rs:31:29:31:34 | Param | Node should have one type but has 0. |
| main.rs:31:37:31:50 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,3 @@ uniqueCallEnclosingCallable
| variables.rs:542:5:542:13 | CallExpr | Call should have one enclosing callable but has 0. |
| variables.rs:543:5:543:13 | CallExpr | Call should have one enclosing callable but has 0. |
| variables.rs:544:5:544:29 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| variables.rs:3:14:3:20 | Param | Node should have one type but has 0. |
| variables.rs:7:14:7:19 | Param | Node should have one type but has 0. |
| variables.rs:11:18:11:24 | Param | Node should have one type but has 0. |
| variables.rs:261:5:261:12 | Param | Node should have one type but has 0. |
| variables.rs:262:5:265:19 | Param | Node should have one type but has 0. |
| variables.rs:272:5:272:50 | Param | Node should have one type but has 0. |
| variables.rs:316:10:316:15 | Param | Node should have one type but has 0. |
| variables.rs:324:10:324:15 | Param | Node should have one type but has 0. |
| variables.rs:356:17:356:28 | Param | Node should have one type but has 0. |
| variables.rs:363:22:363:36 | Param | Node should have one type but has 0. |
| variables.rs:363:39:363:57 | Param | Node should have one type but has 0. |
| variables.rs:435:8:435:15 | Param | Node should have one type but has 0. |
| variables.rs:451:13:451:21 | Param | Node should have one type but has 0. |
| variables.rs:451:24:451:32 | Param | Node should have one type but has 0. |
Original file line number Diff line number Diff line change
Expand Up @@ -212,29 +212,3 @@ uniqueCallEnclosingCallable
| unreachable.rs:247:9:247:14 | CallExpr | Call should have one enclosing callable but has 0. |
| unreachable.rs:248:9:248:22 | CallExpr | Call should have one enclosing callable but has 0. |
| unreachable.rs:252:5:252:18 | CallExpr | Call should have one enclosing callable but has 0. |
uniqueType
| main.rs:140:5:140:10 | Param | Node should have one type but has 0. |
| main.rs:141:5:141:10 | Param | Node should have one type but has 0. |
| main.rs:142:5:142:11 | Param | Node should have one type but has 0. |
| main.rs:149:7:149:12 | Param | Node should have one type but has 0. |
| main.rs:382:19:382:21 | Param | Node should have one type but has 0. |
| main.rs:384:14:384:19 | Param | Node should have one type but has 0. |
| main.rs:411:21:411:28 | Param | Node should have one type but has 0. |
| main.rs:411:31:411:38 | Param | Node should have one type but has 0. |
| main.rs:414:21:414:23 | Param | Node should have one type but has 0. |
| main.rs:414:26:414:28 | Param | Node should have one type but has 0. |
| main.rs:417:21:417:23 | Param | Node should have one type but has 0. |
| main.rs:417:26:417:28 | Param | Node should have one type but has 0. |
| main.rs:420:21:420:23 | Param | Node should have one type but has 0. |
| main.rs:420:26:420:28 | Param | Node should have one type but has 0. |
| main.rs:424:21:424:23 | Param | Node should have one type but has 0. |
| main.rs:424:26:424:28 | Param | Node should have one type but has 0. |
| main.rs:430:29:430:38 | Param | Node should have one type but has 0. |
| main.rs:430:41:430:56 | Param | Node should have one type but has 0. |
| main.rs:440:9:440:18 | Param | Node should have one type but has 0. |
| main.rs:441:9:441:24 | Param | Node should have one type but has 0. |
| more.rs:4:23:4:28 | Param | Node should have one type but has 0. |
| more.rs:8:19:8:24 | Param | Node should have one type but has 0. |
| more.rs:16:23:16:28 | Param | Node should have one type but has 0. |
| more.rs:24:9:24:14 | Param | Node should have one type but has 0. |
| unreachable.rs:10:34:10:34 | Param | Node should have one type but has 0. |

0 comments on commit 60986d8

Please sign in to comment.