File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
rust/ql/consistency-queries Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,13 @@ query predicate scopeNoFirst(CfgScope scope) {
26
26
not scope = any ( ClosureExpr c | not exists ( c .getBody ( ) ) )
27
27
}
28
28
29
+ /** Holds if `be` is the `else` branch of a `let` statement that results in a panic. */
30
+ private predicate letElsePanic ( BlockExpr be ) {
31
+ be = any ( LetStmt let ) .getLetElse ( ) .getBlockExpr ( ) and
32
+ exists ( Completion c | CfgImpl:: last ( be , _, c ) | completionIsNormal ( c ) )
33
+ }
34
+
29
35
query predicate deadEnd ( CfgImpl:: Node node ) {
30
36
Consistency:: deadEnd ( node ) and
31
- // `else` blocks in `let` statements diverge, so they are by definition dead ends
32
- not node .getAstNode ( ) = any ( LetStmt let ) .getLetElse ( ) .getBlockExpr ( )
37
+ not letElsePanic ( node .getAstNode ( ) )
33
38
}
You can’t perform that action at this time.
0 commit comments