Skip to content

Commit fd5e4a4

Browse files
committed
Rust: Follow-up changes after rebase
1 parent 5a2ba69 commit fd5e4a4

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

rust/ql/consistency-queries/PathResolutionConsistency.ql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* @id rust/diagnostics/path-resolution-consistency
66
*/
77

8+
private import rust
9+
private import codeql.rust.internal.PathResolution
810
private import codeql.rust.internal.PathResolutionConsistency as PathResolutionConsistency
911
private import codeql.rust.elements.Locatable
1012
private import codeql.Locations
@@ -25,3 +27,7 @@ query predicate multipleMethodCallTargets(SourceLocatable a, SourceLocatable b)
2527
query predicate multiplePathResolutions(SourceLocatable a, SourceLocatable b) {
2628
PathResolutionConsistency::multiplePathResolutions(a, b)
2729
}
30+
31+
query predicate multipleCanonicalPaths(SourceLocatable i, SourceLocatable c, string path) {
32+
PathResolutionConsistency::multipleCanonicalPaths(i, c, path)
33+
}

rust/ql/lib/codeql/rust/internal/PathResolution.qll

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,7 @@ class CrateItemNode extends ItemNode instanceof Crate {
354354
this.hasCanonicalPath(c) and
355355
exists(ModuleLikeNode m |
356356
child.getImmediateParent() = m and
357-
not m = child.(SourceFileItemNode).getSuper()
358-
|
359-
m = super.getModule() // the special `crate` root module inserted by the extractor
360-
or
357+
not m = child.(SourceFileItemNode).getSuper() and
361358
m = super.getSourceFile()
362359
)
363360
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
11
multipleMethodCallTargets
22
| web_frameworks.rs:194:30:194:74 | ... .get(...) | file://:0:0:0:0 | fn get |
33
| web_frameworks.rs:194:30:194:74 | ... .get(...) | file://:0:0:0:0 | fn get |
4+
multipleCanonicalPaths
5+
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Equal as core::cmp::Ord>::to_ordering |
6+
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Equal as typenum::marker_traits::Ord>::to_ordering |
7+
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Greater as core::cmp::Ord>::to_ordering |
8+
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Greater as typenum::marker_traits::Ord>::to_ordering |
9+
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Less as core::cmp::Ord>::to_ordering |
10+
| file://:0:0:0:0 | fn to_ordering | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Less as typenum::marker_traits::Ord>::to_ordering |
11+
| file://:0:0:0:0 | impl Ord for Equal { ... } | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Equal as core::cmp::Ord> |
12+
| file://:0:0:0:0 | impl Ord for Equal { ... } | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Equal as typenum::marker_traits::Ord> |
13+
| file://:0:0:0:0 | impl Ord for Greater { ... } | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Greater as core::cmp::Ord> |
14+
| file://:0:0:0:0 | impl Ord for Greater { ... } | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Greater as typenum::marker_traits::Ord> |
15+
| file://:0:0:0:0 | impl Ord for Less { ... } | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Less as core::cmp::Ord> |
16+
| file://:0:0:0:0 | impl Ord for Less { ... } | file://:0:0:0:0 | Crate(typenum@1.18.0) | <typenum::Less as typenum::marker_traits::Ord> |

0 commit comments

Comments
 (0)