diff --git a/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll b/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll index 236d848c70e4..da156cd7767c 100644 --- a/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll +++ b/rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll @@ -369,6 +369,8 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr { override predicate entry(AstNode node) { this.first(node) } + override predicate propagatesAbnormal(AstNode child) { child = super.getCondition() } + override predicate first(AstNode node) { first(super.getCondition(), node) } private ConditionalCompletion conditionCompletion(Completion c) { @@ -388,13 +390,6 @@ class WhileExprTree extends LoopingExprTree instanceof WhileExpr { this.conditionCompletion(c).failed() and succ = this } - - override predicate last(AstNode last, Completion c) { - super.last(last, c) - or - last(super.getCondition(), last, c) and - not completionIsNormal(c) - } } class ForExprTree extends LoopingExprTree instanceof ForExpr { @@ -404,6 +399,8 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr { override predicate entry(AstNode n) { first(super.getPat(), n) } + override predicate propagatesAbnormal(AstNode child) { child = super.getIterable() } + override predicate first(AstNode node) { first(super.getIterable(), node) } override predicate succ(AstNode pred, AstNode succ, Completion c) { @@ -421,13 +418,6 @@ class ForExprTree extends LoopingExprTree instanceof ForExpr { c.(MatchCompletion).failed() and succ = this } - - override predicate last(AstNode last, Completion c) { - super.last(last, c) - or - last(super.getIterable(), last, c) and - not completionIsNormal(c) - } } // TODO: replace with expanded macro once the extractor supports it