Skip to content

Commit 8044b0d

Browse files
committed
Rust: Exclude macro call paths from resolvePath
1 parent 7c2bafe commit 8044b0d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ ItemNode resolvePath(RelevantPath path) {
822822
exists(Namespace ns | result = resolvePath0(path, ns) |
823823
pathUsesNamespace(path, ns)
824824
or
825-
not pathUsesNamespace(path, _)
825+
not pathUsesNamespace(path, _) and
826+
not path = any(MacroCall mc).getPath()
826827
)
827828
}
828829

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ private import PathResolution
77

88
/** Holds if `p` may resolve to multiple items including `i`. */
99
query predicate multiplePathResolutions(Path p, ItemNode i) {
10+
p.fromSource() and
1011
i = resolvePath(p) and
1112
// `use foo::bar` may use both a type `bar` and a value `bar`
1213
not p =

0 commit comments

Comments
 (0)