diff --git a/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll b/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll index feec95057a4d..cbf636bd9f00 100644 --- a/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll +++ b/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll @@ -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 diff --git a/rust/ql/test/library-tests/controlflow/Cfg.expected b/rust/ql/test/library-tests/controlflow/Cfg.expected index 621b84d33636..85ea30a20bb2 100644 --- a/rust/ql/test/library-tests/controlflow/Cfg.expected +++ b/rust/ql/test/library-tests/controlflow/Cfg.expected @@ -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 | |