Skip to content

Commit 0fa40fc

Browse files
committed
Rust: Fix captured variable data flow inconsistency
1 parent 16dcc5c commit 0fa40fc

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/DataFlowImpl.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ private import codeql.dataflow.DataFlow
88
private import codeql.dataflow.internal.DataFlowImpl
99
private import rust
1010
private import SsaImpl as SsaImpl
11+
private import codeql.rust.controlflow.internal.Scope as Scope
1112
private import codeql.rust.controlflow.ControlFlowGraph
1213
private import codeql.rust.controlflow.CfgNodes
1314
private import codeql.rust.dataflow.Ssa
@@ -771,7 +772,12 @@ class LambdaCallKind = Unit;
771772

772773
/** Holds if `creation` is an expression that creates a lambda of kind `kind`. */
773774
private predicate lambdaCreationExpr(Expr creation, LambdaCallKind kind) {
774-
creation instanceof ClosureExpr and exists(kind)
775+
(
776+
creation instanceof ClosureExpr
777+
or
778+
creation instanceof Scope::AsyncBlockScope
779+
) and
780+
exists(kind)
775781
}
776782

777783
/**

rust/ql/test/library-tests/controlflow/CONSISTENCY/VariableCaptureConsistency.expected

Lines changed: 0 additions & 5 deletions
This file was deleted.

rust/ql/test/library-tests/variables/CONSISTENCY/VariableCaptureConsistency.expected

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)