Skip to content

Commit

Permalink
Rust: Account for let statement else blocks in deadEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
hvitved committed Oct 1, 2024
1 parent a606dd2 commit 2c167a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions rust/ql/consistency-queries/CfgConsistency.ql
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ query predicate scopeNoFirst(CfgScope scope) {
not scope = any(Function f | not exists(f.getBody())) and
not scope = any(ClosureExpr c | not exists(c.getBody()))
}

query predicate deadEnd(CfgImpl::Node node) {
Consistency::deadEnd(node) and
// `else` blocks in `let` statements diverge, so they are by definition dead ends
not node.getAstNode() = any(LetStmt let).getLetElse().getBlockExpr()
}

This file was deleted.

0 comments on commit 2c167a6

Please sign in to comment.