Skip to content

Commit b86a581

Browse files
committed
Rust: Small refactor based on PR feedback
1 parent c5b01eb commit b86a581

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module SsaInput implements SsaImplCommon::InputSig<Location> {
5858
this.isMutable()
5959
implies
6060
not exists(VariableAccess va | va = this.getAnAccess() |
61-
exists(RefExpr re | va = re.getExpr() and re.isMut())
61+
va = any(RefExpr re | re.isMut()).getExpr()
6262
or
6363
// receivers can be borrowed implicitly, cf.
6464
// https://doc.rust-lang.org/reference/expressions/method-call-expr.html
@@ -238,7 +238,7 @@ private predicate lastRefSkipUncertainReadsExt(DefinitionExt def, BasicBlock bb,
238238
)
239239
}
240240

241-
private VariableAccess getCapturedVariableAccess(BasicBlock bb, Variable v) {
241+
private VariableAccess getACapturedVariableAccess(BasicBlock bb, Variable v) {
242242
result = bb.getANode().getAstNode() and
243243
result.isCapture() and
244244
result.getVariable() = v
@@ -247,13 +247,13 @@ private VariableAccess getCapturedVariableAccess(BasicBlock bb, Variable v) {
247247
/** Holds if `bb` contains a captured write to variable `v`. */
248248
pragma[noinline]
249249
private predicate writesCapturedVariable(BasicBlock bb, Variable v) {
250-
getCapturedVariableAccess(bb, v) instanceof VariableWriteAccess
250+
getACapturedVariableAccess(bb, v) instanceof VariableWriteAccess
251251
}
252252

253253
/** Holds if `bb` contains a captured read to variable `v`. */
254254
pragma[nomagic]
255255
private predicate readsCapturedVariable(BasicBlock bb, Variable v) {
256-
getCapturedVariableAccess(bb, v) instanceof VariableReadAccess
256+
getACapturedVariableAccess(bb, v) instanceof VariableReadAccess
257257
}
258258

259259
/**

0 commit comments

Comments
 (0)