Skip to content

Commit d9636b3

Browse files
committed
Rust: Add data flow test with assignment to mutable variable
1 parent 8d59b92 commit d9636b3

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
uniqueEnclosingCallable
22
| main.rs:6:18:6:27 | Param | Node should have one enclosing callable but has 0. |
3-
| main.rs:25:21:25:26 | Param | Node should have one enclosing callable but has 0. |
4-
| main.rs:25:29:25:34 | Param | Node should have one enclosing callable but has 0. |
5-
| main.rs:25:37:25:50 | Param | Node should have one enclosing callable but has 0. |
3+
| main.rs:31:21:31:26 | Param | Node should have one enclosing callable but has 0. |
4+
| main.rs:31:29:31:34 | Param | Node should have one enclosing callable but has 0. |
5+
| main.rs:31:37:31:50 | Param | Node should have one enclosing callable but has 0. |
66
uniqueCallEnclosingCallable
77
| main.rs:3:14:3:33 | CallExpr | Call should have one enclosing callable but has 0. |
8-
| main.rs:33:5:33:14 | CallExpr | Call should have one enclosing callable but has 0. |
9-
| main.rs:34:5:34:23 | CallExpr | Call should have one enclosing callable but has 0. |
8+
| main.rs:39:5:39:14 | CallExpr | Call should have one enclosing callable but has 0. |
9+
| main.rs:40:5:40:23 | CallExpr | Call should have one enclosing callable but has 0. |
1010
uniqueType
1111
| main.rs:6:18:6:27 | Param | Node should have one type but has 0. |
12-
| main.rs:25:21:25:26 | Param | Node should have one type but has 0. |
13-
| main.rs:25:29:25:34 | Param | Node should have one type but has 0. |
14-
| main.rs:25:37:25:50 | Param | Node should have one type but has 0. |
12+
| main.rs:31:21:31:26 | Param | Node should have one type but has 0. |
13+
| main.rs:31:29:31:34 | Param | Node should have one type but has 0. |
14+
| main.rs:31:37:31:50 | Param | Node should have one type but has 0. |

rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| main.rs:20:9:20:15 | BreakExpr | main.rs:19:13:21:5 | LoopExpr |
77
| main.rs:20:15:20:15 | a | main.rs:20:9:20:15 | BreakExpr |
88
| main.rs:22:5:22:5 | b | main.rs:17:29:23:1 | BlockExpr |
9-
| main.rs:26:5:29:5 | MatchExpr | main.rs:25:60:30:1 | BlockExpr |
10-
| main.rs:27:20:27:20 | a | main.rs:26:5:29:5 | MatchExpr |
11-
| main.rs:28:17:28:17 | b | main.rs:26:5:29:5 | MatchExpr |
9+
| main.rs:28:5:28:5 | i | main.rs:25:24:29:1 | BlockExpr |
10+
| main.rs:32:5:35:5 | MatchExpr | main.rs:31:60:36:1 | BlockExpr |
11+
| main.rs:33:20:33:20 | a | main.rs:32:5:35:5 | MatchExpr |
12+
| main.rs:34:17:34:17 | b | main.rs:32:5:35:5 | MatchExpr |

rust/ql/test/library-tests/dataflow/local/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ fn loop_expression() -> i64 {
2222
b
2323
}
2424

25+
fn assignment() -> i64 {
26+
let mut i = 1;
27+
i = 2;
28+
i
29+
}
30+
2531
fn match_expression(a: i64, b: i64, c: Option<i64>) -> i64 {
2632
match c {
2733
Some(_) => a,

0 commit comments

Comments
 (0)