Skip to content

Commit 6a5a505

Browse files
committed
Rust: Address QL suggestions for CFG implementation
1 parent 7a369f8 commit 6a5a505

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module CfgImpl = Make<Location, CfgInput>;
5959

6060
import CfgImpl
6161

62-
/** A trivial pattern that is always guaranteed to match. */
62+
/** Holds for a trivial pattern that is always guaranteed to match. */
6363
predicate trivialPat(Pat p) { p instanceof WildcardPat or p instanceof IdentPat }
6464

6565
class AsmExprTree extends LeafTree instanceof AsmExpr { }
@@ -303,7 +303,7 @@ class LoopExprTree extends PostOrderTree instanceof LoopExpr {
303303

304304
override predicate first(AstNode node) { first(super.getBody(), node) }
305305

306-
/** Whether this `LoopExpr` captures a completion for a `break`/`continue`. */
306+
/** Whether this `LoopExpr` captures the `c` completion. */
307307
predicate capturesLoopJumpCompletion(LoopJumpCompletion c) {
308308
not c.hasLabel()
309309
or
@@ -379,7 +379,8 @@ class MatchExprTree extends PostOrderTree instanceof MatchExpr {
379379
c.(ConditionalCompletion).failed()
380380
)
381381
or
382-
exists(int i | last(super.getBranch(i), pred, c) and succ = this and completionIsSimple(c))
382+
// Edge from the end of each arm to the match expression.
383+
last(super.getBranch(_), pred, c) and succ = this and completionIsSimple(c)
383384
}
384385
}
385386

0 commit comments

Comments
 (0)