From 284df7fcf30e5920142ba73733cae5407f75ba6c Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Wed, 26 Mar 2025 11:29:34 +0100 Subject: [PATCH] Rust: Also resolve `crate` paths in non-source files --- rust/ql/lib/codeql/rust/internal/PathResolution.qll | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust/ql/lib/codeql/rust/internal/PathResolution.qll b/rust/ql/lib/codeql/rust/internal/PathResolution.qll index 2128bb8e7a82..169e3c365b07 100644 --- a/rust/ql/lib/codeql/rust/internal/PathResolution.qll +++ b/rust/ql/lib/codeql/rust/internal/PathResolution.qll @@ -187,7 +187,12 @@ abstract class ItemNode extends Locatable { this = result.(ImplOrTraitItemNode).getAnItemInSelfScope() or name = "crate" and - this = result.(CrateItemNode).getASourceFile() + result = + any(CrateItemNode crate | + this = crate.getASourceFile() + or + this = crate.getModuleNode() + ) } /** Gets the location of this item. */