mirror of
https://github.com/github/codeql.git
synced 2026-04-22 07:15:15 +02:00
Rust: normalize paths in the rustup folder
This commit is contained in:
@@ -319,7 +319,7 @@ resolvePath
|
||||
| my.rs:18:9:18:11 | my4 | my.rs:14:1:16:1 | mod my4 |
|
||||
| my.rs:18:9:18:16 | ...::my5 | my.rs:15:5:15:16 | mod my5 |
|
||||
| my.rs:18:9:18:19 | ...::f | my/my4/my5/mod.rs:1:1:3:1 | fn f |
|
||||
| my.rs:22:5:22:9 | std | file:///Users/arthur/.rustup/toolchains/1.85-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/lib.rs:0:0:0:0 | Crate(std@0.0.0) |
|
||||
| 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) |
|
||||
| my.rs:22:5:22:17 | ...::result | file://:0:0:0:0 | mod result |
|
||||
| my.rs:22:5:25:1 | ...::Result::<...> | file://:0:0:0:0 | enum Result |
|
||||
| my.rs:23:5:23:5 | T | my.rs:21:5:21:5 | T |
|
||||
|
||||
@@ -5,6 +5,17 @@ import TestUtils
|
||||
|
||||
query predicate mod(Module m) { toBeTested(m) }
|
||||
|
||||
query predicate resolvePath(Path p, ItemNode i) {
|
||||
class ItemNodeLoc extends Locatable instanceof ItemNode {
|
||||
predicate hasLocationInfo(
|
||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
exists(string file |
|
||||
super.getLocation().hasLocationInfo(file, startline, startcolumn, endline, endcolumn) and
|
||||
filepath = file.regexpReplaceAll("^/.*/.rustup/toolchains/[^/]+/", "/RUSTUP_HOME/toolchain/")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
query predicate resolvePath(Path p, ItemNodeLoc i) {
|
||||
toBeTested(p) and not p.isInMacroExpansion() and i = resolvePath(p)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user