Skip to content

Commit 59c796c

Browse files
author
Paolo Tranquilli
committed
Merge branch 'main' into redsun82/cargo-upgrade-3
2 parents 43e525e + 76c6d71 commit 59c796c

File tree

12 files changed

+684
-682
lines changed

12 files changed

+684
-682
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @kind test-postprocess
3+
*/
4+
5+
private import rust
6+
private import codeql.util.test.ExternalLocationPostProcessing
7+
import Make<getSourceLocationPrefix/0>
8+
9+
private string getSourceLocationPrefix() { sourceLocationPrefix(result) }

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

Lines changed: 105 additions & 105 deletions
Large diffs are not rendered by default.

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

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,14 @@ query predicate localStep(DataFlow::Node nodeFrom, DataFlow::Node nodeTo) {
88
RustDataFlow::simpleLocalFlowStep(nodeFrom, nodeTo, "")
99
}
1010

11-
class Content extends DataFlow::Content {
12-
predicate hasLocationInfo(
13-
string filepath, int startline, int startcolumn, int endline, int endcolumn
14-
) {
15-
exists(string file |
16-
this.getLocation().hasLocationInfo(file, startline, startcolumn, endline, endcolumn) and
17-
filepath =
18-
file.regexpReplaceAll("^/.*/tools/builtins/", "/BUILTINS/")
19-
.regexpReplaceAll("^/.*/.rustup/toolchains/[^/]+/", "/RUSTUP_HOME/toolchain/")
20-
)
21-
}
22-
}
23-
2411
class Node extends DataFlow::Node {
2512
Node() { not this instanceof FlowSummaryNode }
2613
}
2714

28-
query predicate storeStep(Node node1, Content c, Node node2) {
15+
query predicate storeStep(Node node1, DataFlow::Content c, Node node2) {
2916
RustDataFlow::storeContentStep(node1, c, node2)
3017
}
3118

32-
query predicate readStep(Node node1, Content c, Node node2) {
19+
query predicate readStep(Node node1, DataFlow::Content c, Node node2) {
3320
RustDataFlow::readContentStep(node1, c, node2)
3421
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: DataFlowStep.ql
2+
postprocess: utils/test/ExternalLocationPostProcessing.ql

rust/ql/test/library-tests/path-resolution/path-resolution.expected

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
testFailures
21
mod
32
| lib.rs:1:1:1:7 | mod my |
43
| main.rs:1:1:1:7 | mod my |
@@ -77,7 +76,7 @@ resolvePath
7776
| main.rs:68:5:68:8 | self | main.rs:1:1:653:2 | SourceFile |
7877
| main.rs:68:5:68:11 | ...::i | main.rs:71:1:83:1 | fn i |
7978
| main.rs:74:13:74:15 | Foo | main.rs:48:1:48:13 | struct Foo |
80-
| main.rs:78:16:78:18 | i32 | file:///BUILTINS/types.rs:12:1:12:15 | struct i32 |
79+
| main.rs:78:16:78:18 | i32 | {EXTERNAL LOCATION} | struct i32 |
8180
| main.rs:81:17:81:19 | Foo | main.rs:77:9:79:9 | struct Foo |
8281
| main.rs:85:5:85:7 | my2 | main.rs:7:1:7:8 | mod my2 |
8382
| main.rs:85:5:85:16 | ...::nested2 | my2/mod.rs:1:1:1:16 | mod nested2 |
@@ -93,8 +92,8 @@ resolvePath
9392
| main.rs:117:13:117:21 | ...::m5 | main.rs:103:1:107:1 | mod m5 |
9493
| main.rs:118:9:118:9 | f | main.rs:104:5:106:5 | fn f |
9594
| main.rs:118:9:118:9 | f | main.rs:110:5:112:5 | fn f |
96-
| main.rs:125:13:125:15 | i32 | file:///BUILTINS/types.rs:12:1:12:15 | struct i32 |
97-
| main.rs:128:16:128:18 | i32 | file:///BUILTINS/types.rs:12:1:12:15 | struct i32 |
95+
| main.rs:125:13:125:15 | i32 | {EXTERNAL LOCATION} | struct i32 |
96+
| main.rs:128:16:128:18 | i32 | {EXTERNAL LOCATION} | struct i32 |
9897
| main.rs:134:19:134:24 | MyEnum | main.rs:123:5:131:5 | enum MyEnum |
9998
| main.rs:137:17:137:22 | MyEnum | main.rs:123:5:131:5 | enum MyEnum |
10099
| main.rs:137:17:137:25 | ...::A | main.rs:124:9:126:9 | A |
@@ -351,19 +350,20 @@ resolvePath
351350
| my.rs:18:9:18:11 | my4 | my.rs:14:1:16:1 | mod my4 |
352351
| my.rs:18:9:18:16 | ...::my5 | my.rs:15:5:15:16 | mod my5 |
353352
| my.rs:18:9:18:19 | ...::f | my/my4/my5/mod.rs:1:1:3:1 | fn f |
354-
| my.rs:22:5:22:9 | std | file:///RUSTUP_HOME/toolchain/lib/rustlib/src/rust/library/std/src/lib.rs:0:0:0:0 | Crate(std@0.0.0) |
355-
| my.rs:22:5:22:17 | ...::result | file:///RUSTUP_HOME/toolchain/lib/rustlib/src/rust/library/core/src/lib.rs:365:1:365:15 | mod result |
356-
| my.rs:22:5:24:12 | ...::Result::<...> | file:///RUSTUP_HOME/toolchain/lib/rustlib/src/rust/library/core/src/result.rs:520:1:538:1 | enum Result |
353+
| my.rs:22:5:22:9 | std | {EXTERNAL LOCATION} | Crate(std@0.0.0) |
354+
| my.rs:22:5:22:17 | ...::result | {EXTERNAL LOCATION} | mod result |
355+
| my.rs:22:5:24:12 | ...::Result::<...> | {EXTERNAL LOCATION} | enum Result |
357356
| my.rs:23:5:23:5 | T | my.rs:21:5:21:5 | T |
358-
| my.rs:28:8:28:10 | i32 | file:///BUILTINS/types.rs:12:1:12:15 | struct i32 |
359-
| my.rs:29:8:29:10 | i32 | file:///BUILTINS/types.rs:12:1:12:15 | struct i32 |
357+
| my.rs:28:8:28:10 | i32 | {EXTERNAL LOCATION} | struct i32 |
358+
| my.rs:29:8:29:10 | i32 | {EXTERNAL LOCATION} | struct i32 |
360359
| my.rs:30:6:30:16 | Result::<...> | my.rs:18:34:25:1 | type Result<...> |
361-
| my.rs:30:13:30:15 | i32 | file:///BUILTINS/types.rs:12:1:12:15 | struct i32 |
362-
| my.rs:33:16:33:18 | Err | file:///RUSTUP_HOME/toolchain/lib/rustlib/src/rust/library/core/src/result.rs:534:5:537:56 | Err |
363-
| my.rs:35:5:35:6 | Ok | file:///RUSTUP_HOME/toolchain/lib/rustlib/src/rust/library/core/src/result.rs:529:5:532:55 | Ok |
360+
| my.rs:30:13:30:15 | i32 | {EXTERNAL LOCATION} | struct i32 |
361+
| my.rs:33:16:33:18 | Err | {EXTERNAL LOCATION} | Err |
362+
| my.rs:35:5:35:6 | Ok | {EXTERNAL LOCATION} | Ok |
364363
| my/nested.rs:9:13:9:13 | f | my/nested.rs:3:9:5:9 | fn f |
365364
| my/nested.rs:15:9:15:15 | nested2 | my/nested.rs:2:5:11:5 | mod nested2 |
366365
| my/nested.rs:15:9:15:18 | ...::f | my/nested.rs:3:9:5:9 | fn f |
367366
| my/nested.rs:21:5:21:11 | nested1 | my/nested.rs:1:1:17:1 | mod nested1 |
368367
| my/nested.rs:21:5:21:20 | ...::nested2 | my/nested.rs:2:5:11:5 | mod nested2 |
369368
| my/nested.rs:21:5:21:23 | ...::f | my/nested.rs:3:9:5:9 | fn f |
369+
testFailures

rust/ql/test/library-tests/path-resolution/path-resolution.ql

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,7 @@ import TestUtils
55

66
query predicate mod(Module m) { toBeTested(m) }
77

8-
final private class ItemNodeFinal = ItemNode;
9-
10-
class ItemNodeLoc extends ItemNodeFinal {
11-
predicate hasLocationInfo(
12-
string filepath, int startline, int startcolumn, int endline, int endcolumn
13-
) {
14-
exists(string file |
15-
this.getLocation().hasLocationInfo(file, startline, startcolumn, endline, endcolumn) and
16-
filepath =
17-
file.regexpReplaceAll("^/.*/.rustup/toolchains/[^/]+/", "/RUSTUP_HOME/toolchain/")
18-
.regexpReplaceAll("^/.*/tools/builtins/", "/BUILTINS/")
19-
)
20-
}
21-
}
22-
23-
query predicate resolvePath(Path p, ItemNodeLoc i) {
8+
query predicate resolvePath(Path p, ItemNode i) {
249
toBeTested(p) and
2510
not p.isFromMacroExpansion() and
2611
i = resolvePath(p)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
query: path-resolution.ql
2+
postprocess: utils/test/ExternalLocationPostProcessing.ql

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy