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) {
2626 not scope = any ( ClosureExpr c | not exists ( c .getBody ( ) ) )
2727}
2828
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+
2935query predicate deadEnd ( CfgImpl:: Node node ) {
3036 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 ( ) )
3338}
You can’t perform that action at this time.
0 commit comments