File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed
lib/codeql/rust/dataflow/internal
test/library-tests/variables Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -55,16 +55,14 @@ module SsaInput implements SsaImplCommon::InputSig<Location> {
55
55
*/
56
56
class SourceVariable extends Variable {
57
57
SourceVariable ( ) {
58
- this .isImmutable ( )
59
- or
60
- this .isMutable ( ) and
61
- forall ( VariableAccess va | va = this . getAnAccess ( ) |
62
- va instanceof VariableReadAccess and
58
+ this .isMutable ( )
59
+ implies
60
+ not exists ( VariableAccess va | va = this .getAnAccess ( ) |
61
+ exists ( RefExpr re | va = re . getExpr ( ) and re . isMut ( ) )
62
+ or
63
63
// receivers can be borrowed implicitly, cf.
64
64
// https://doc.rust-lang.org/reference/expressions/method-call-expr.html
65
- not va = any ( MethodCallExpr mce ) .getReceiver ( )
66
- or
67
- variableWrite ( va , this )
65
+ va = any ( MethodCallExpr mce ) .getReceiver ( )
68
66
)
69
67
}
70
68
}
Original file line number Diff line number Diff line change 1
1
nonSsaVariable
2
- | variables.rs:28:13:28:13 | x |
3
2
| variables.rs:341:13:341:13 | a |
4
3
| variables.rs:349:13:349:13 | i |
5
4
| variables.rs:372:13:372:13 | x |
@@ -15,6 +14,8 @@ definition
15
14
| variables.rs:16:9:16:10 | x1 | variables.rs:16:9:16:10 | x1 |
16
15
| variables.rs:21:9:21:14 | x2 | variables.rs:21:13:21:14 | x2 |
17
16
| variables.rs:23:5:23:6 | x2 | variables.rs:21:13:21:14 | x2 |
17
+ | variables.rs:28:9:28:13 | x | variables.rs:28:13:28:13 | x |
18
+ | variables.rs:30:5:30:5 | x | variables.rs:28:13:28:13 | x |
18
19
| variables.rs:35:9:35:10 | x3 | variables.rs:35:9:35:10 | x3 |
19
20
| variables.rs:37:9:37:10 | x3 | variables.rs:37:9:37:10 | x3 |
20
21
| variables.rs:43:9:43:10 | x4 | variables.rs:43:9:43:10 | x4 |
@@ -542,6 +543,7 @@ ultimateDef
542
543
| variables.rs:439:5:447:5 | phi | variables.rs:444:9:444:9 | x |
543
544
assigns
544
545
| variables.rs:23:5:23:6 | x2 | variables.rs:23:10:23:10 | 5 |
546
+ | variables.rs:30:5:30:5 | x | variables.rs:30:9:30:9 | 2 |
545
547
| variables.rs:421:9:421:9 | y | variables.rs:421:13:421:13 | 3 |
546
548
| variables.rs:440:9:440:9 | x | variables.rs:440:13:440:13 | 2 |
547
549
| variables.rs:444:9:444:9 | x | variables.rs:444:13:444:13 | 3 |
You can’t perform that action at this time.
0 commit comments