Skip to content

Commit a19f1d0

Browse files
committed
Rust: Remove store step for repeat operand in array expression
1 parent c62b7d1 commit a19f1d0

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -984,11 +984,12 @@ module RustDataFlow implements InputSig<Location> {
984984
node2.asExpr() = tuple
985985
)
986986
or
987-
exists(ArrayExprCfgNode arr |
988-
c instanceof ArrayElementContent and
989-
node1.asExpr() = arr.getAnExpr() and
990-
node2.asExpr() = arr
991-
)
987+
c instanceof ArrayElementContent and
988+
node1.asExpr() =
989+
[
990+
node2.asExpr().(ArrayRepeatExprCfgNode).getRepeatOperand(),
991+
node2.asExpr().(ArrayListExprCfgNode).getAnExpr()
992+
]
992993
or
993994
tupleAssignment(node1, node2.(PostUpdateNode).getPreUpdateNode(), c)
994995
or

rust/ql/test/library-tests/dataflow/local/DataFlowStep.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,6 @@ storeStep
524524
| main.rs:336:20:336:20 | 2 | array[] | main.rs:336:16:336:33 | [...] |
525525
| main.rs:336:23:336:32 | source(...) | array[] | main.rs:336:16:336:33 | [...] |
526526
| main.rs:340:17:340:26 | source(...) | array[] | main.rs:340:16:340:31 | [...; 10] |
527-
| main.rs:340:29:340:30 | 10 | array[] | main.rs:340:16:340:31 | [...; 10] |
528527
| main.rs:344:17:344:17 | 1 | array[] | main.rs:344:16:344:24 | [...] |
529528
| main.rs:344:20:344:20 | 2 | array[] | main.rs:344:16:344:24 | [...] |
530529
| main.rs:344:23:344:23 | 3 | array[] | main.rs:344:16:344:24 | [...] |

0 commit comments

Comments
 (0)