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> {
5555 */
5656 class SourceVariable extends Variable {
5757 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
6363 // receivers can be borrowed implicitly, cf.
6464 // 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 ( )
6866 )
6967 }
7068 }
Original file line number Diff line number Diff line change 11nonSsaVariable
2- | variables.rs:28:13:28:13 | x |
32| variables.rs:341:13:341:13 | a |
43| variables.rs:349:13:349:13 | i |
54| variables.rs:372:13:372:13 | x |
@@ -15,6 +14,8 @@ definition
1514| variables.rs:16:9:16:10 | x1 | variables.rs:16:9:16:10 | x1 |
1615| variables.rs:21:9:21:14 | x2 | variables.rs:21:13:21:14 | x2 |
1716| 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 |
1819| variables.rs:35:9:35:10 | x3 | variables.rs:35:9:35:10 | x3 |
1920| variables.rs:37:9:37:10 | x3 | variables.rs:37:9:37:10 | x3 |
2021| variables.rs:43:9:43:10 | x4 | variables.rs:43:9:43:10 | x4 |
@@ -542,6 +543,7 @@ ultimateDef
542543| variables.rs:439:5:447:5 | phi | variables.rs:444:9:444:9 | x |
543544assigns
544545| 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 |
545547| variables.rs:421:9:421:9 | y | variables.rs:421:13:421:13 | 3 |
546548| variables.rs:440:9:440:9 | x | variables.rs:440:13:440:13 | 2 |
547549| 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