Skip to content

Commit

Permalink
Rust: Remove erroneous CFG edge from return to break
Browse files Browse the repository at this point in the history
  • Loading branch information
paldepind committed Oct 18, 2024
1 parent 4ca6b0e commit 28f111b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class BreakExprTree extends PostOrderTree, BreakExpr {
override predicate last(AstNode last, Completion c) { none() }

override predicate succ(AstNode pred, AstNode succ, Completion c) {
last(super.getExpr(), pred, c) and succ = this
last(super.getExpr(), pred, c) and completionIsNormal(c) and succ = this
or
pred = this and
c.isValidFor(pred) and
Expand Down
4 changes: 0 additions & 4 deletions rust/ql/test/library-tests/controlflow/Cfg.expected
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,8 @@ edges
| test.rs:102:13:102:14 | ExprStmt | test.rs:102:13:102:13 | 1 | |
| test.rs:106:5:110:5 | enter break_with_return | test.rs:108:13:108:27 | ExprStmt | |
| test.rs:106:5:110:5 | exit break_with_return (normal) | test.rs:106:5:110:5 | exit break_with_return | |
| test.rs:106:35:110:5 | BlockExpr | test.rs:106:5:110:5 | exit break_with_return (normal) | |
| test.rs:107:9:109:9 | LoopExpr | test.rs:106:35:110:5 | BlockExpr | |
| test.rs:108:13:108:26 | BreakExpr | test.rs:107:9:109:9 | LoopExpr | break |
| test.rs:108:13:108:27 | ExprStmt | test.rs:108:26:108:26 | 1 | |
| test.rs:108:19:108:26 | ReturnExpr | test.rs:106:5:110:5 | exit break_with_return (normal) | return |
| test.rs:108:19:108:26 | ReturnExpr | test.rs:108:13:108:26 | BreakExpr | return |
| test.rs:108:26:108:26 | 1 | test.rs:108:19:108:26 | ReturnExpr | |
| test.rs:113:1:116:1 | enter test_nested_function | test.rs:113:25:113:25 | n | |
| test.rs:113:1:116:1 | exit test_nested_function (normal) | test.rs:113:1:116:1 | exit test_nested_function | |
Expand Down

0 comments on commit 28f111b

Please sign in to comment.