Skip to content

Commit f093c49

Browse files
aibaarshvitved
authored andcommitted
Rust: normalize file paths for PathResolutionConsistency.ql
1 parent 81f0e42 commit f093c49

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

rust/ql/consistency-queries/PathResolutionConsistency.ql

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,25 @@
55
* @id rust/diagnostics/path-resolution-consistency
66
*/
77

8-
import codeql.rust.internal.PathResolutionConsistency
8+
private import codeql.rust.internal.PathResolutionConsistency as PathResolutionConsistency
9+
private import codeql.rust.elements.Locatable
10+
private import codeql.Locations
11+
import PathResolutionConsistency
12+
13+
class SourceLocatable instanceof Locatable {
14+
string toString() { result = super.toString() }
15+
16+
Location getLocation() {
17+
if super.getLocation().fromSource()
18+
then result = super.getLocation()
19+
else result instanceof EmptyLocation
20+
}
21+
}
22+
23+
query predicate multipleMethodCallTargets(SourceLocatable a, SourceLocatable b) {
24+
PathResolutionConsistency::multipleMethodCallTargets(a, b)
25+
}
26+
27+
query predicate multiplePathResolutions(SourceLocatable a, SourceLocatable b) {
28+
PathResolutionConsistency::multiplePathResolutions(a, b)
29+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
multipleMethodCallTargets
2+
| web_frameworks.rs:194:30:194:74 | ... .get(...) | file://:0:0:0:0 | fn get |
3+
| web_frameworks.rs:194:30:194:74 | ... .get(...) | file://:0:0:0:0 | fn get |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
multiplePathResolutions
2+
| test.rs:50:3:50:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
3+
| test.rs:50:3:50:6 | ctor | file://:0:0:0:0 | fn ctor |
4+
| test.rs:55:3:55:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
5+
| test.rs:55:3:55:6 | ctor | file://:0:0:0:0 | fn ctor |
6+
| test.rs:60:3:60:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
7+
| test.rs:60:3:60:6 | ctor | file://:0:0:0:0 | fn ctor |
8+
| test.rs:65:3:65:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
9+
| test.rs:65:3:65:6 | ctor | file://:0:0:0:0 | fn ctor |
10+
| test.rs:73:3:73:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
11+
| test.rs:73:3:73:6 | ctor | file://:0:0:0:0 | fn ctor |
12+
| test.rs:78:3:78:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
13+
| test.rs:78:3:78:6 | ctor | file://:0:0:0:0 | fn ctor |
14+
| test.rs:87:3:87:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
15+
| test.rs:87:3:87:6 | ctor | file://:0:0:0:0 | fn ctor |
16+
| test.rs:94:3:94:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
17+
| test.rs:94:3:94:6 | ctor | file://:0:0:0:0 | fn ctor |
18+
| test.rs:128:3:128:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
19+
| test.rs:128:3:128:6 | ctor | file://:0:0:0:0 | fn ctor |
20+
| test.rs:139:3:139:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
21+
| test.rs:139:3:139:6 | ctor | file://:0:0:0:0 | fn ctor |
22+
| test.rs:144:3:144:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
23+
| test.rs:144:3:144:6 | ctor | file://:0:0:0:0 | fn ctor |
24+
| test.rs:150:3:150:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
25+
| test.rs:150:3:150:6 | ctor | file://:0:0:0:0 | fn ctor |
26+
| test.rs:168:3:168:6 | ctor | file://:0:0:0:0 | Crate([email protected]) |
27+
| test.rs:168:3:168:6 | ctor | file://:0:0:0:0 | fn ctor |

0 commit comments

Comments
 (0)