Skip to content

Commit 24f39cc

Browse files
committed
Rust: Weaken scopeNoFirst check
1 parent a3ad6f5 commit 24f39cc

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

rust/ql/consistency-queries/CfgConsistency.ql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import rust
2-
import codeql.rust.controlflow.internal.ControlFlowGraphImpl::Consistency
2+
import codeql.rust.controlflow.internal.ControlFlowGraphImpl::Consistency as Consistency
3+
import Consistency
4+
import codeql.rust.controlflow.ControlFlowGraph
35
import codeql.rust.controlflow.internal.ControlFlowGraphImpl as CfgImpl
46
import codeql.rust.controlflow.internal.Completion
57

@@ -17,3 +19,9 @@ query predicate nonPostOrderExpr(Expr e, string cls) {
1719
c instanceof NormalCompletion
1820
)
1921
}
22+
23+
query predicate scopeNoFirst(CfgScope scope) {
24+
Consistency::scopeNoFirst(scope) and
25+
not scope = any(Function f | not exists(f.getBody())) and
26+
not scope = any(ClosureExpr c | not exists(c.getBody()))
27+
}

rust/ql/test/library-tests/controlflow/Cfg.ql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/**
2-
* @id rust/controlflow/cfg
3-
*/
4-
51
import rust
62
import codeql.rust.controlflow.ControlFlowGraph
73
import TestUtils

0 commit comments

Comments
 (0)