We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
deadEnd
1 parent 8595776 commit e8cb349Copy full SHA for e8cb349
1 file changed
rust/ql/consistency-queries/CfgConsistency.ql
@@ -26,8 +26,13 @@ query predicate scopeNoFirst(CfgScope scope) {
26
not scope = any(ClosureExpr c | not exists(c.getBody()))
27
}
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
+
35
query predicate deadEnd(CfgImpl::Node node) {
36
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()
37
+ not letElsePanic(node.getAstNode())
38
0 commit comments