Skip to content

Commit 6a9ed88

Browse files
authored
Merge pull request #19975 from hvitved/rust/ssa-phi-in-capture
Rust: Fix SSA inconsistencies
2 parents f714e5c + d1dd05e commit 6a9ed88

File tree

6 files changed

+2932
-2803
lines changed

6 files changed

+2932
-2803
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,6 @@ private predicate writesCapturedVariable(BasicBlock bb, Variable v) {
144144
getACapturedVariableAccess(bb, v) instanceof VariableWriteAccess
145145
}
146146

147-
/** Holds if `bb` contains a captured read to variable `v`. */
148-
pragma[nomagic]
149-
private predicate readsCapturedVariable(BasicBlock bb, Variable v) {
150-
variableReadCertain(_, _, getACapturedVariableAccess(bb, v), _)
151-
}
152-
153147
/**
154148
* Holds if captured variable `v` is read directly inside `scope`,
155149
* or inside a (transitively) nested scope of `scope`.
@@ -229,7 +223,7 @@ private module Cached {
229223
*/
230224
cached
231225
predicate capturedEntryWrite(EntryBasicBlock bb, int i, Variable v) {
232-
readsCapturedVariable(bb.getASuccessor*(), v) and
226+
exists(getACapturedVariableAccess(bb.getASuccessor*(), v)) and
233227
i = -1
234228
}
235229

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
multipleCallTargets
2-
| main.rs:85:19:85:40 | ...::from(...) |
3-
| main.rs:102:19:102:40 | ...::from(...) |
2+
| main.rs:87:19:87:40 | ...::from(...) |
3+
| main.rs:106:19:106:40 | ...::from(...) |

0 commit comments

Comments
 (0)