From fbab715cb6a17a69cd2766075c0928b4a905b3bc Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Wed, 9 Apr 2025 15:20:33 +0200 Subject: [PATCH] Rust: Allow for crate self-references in crate graph paths --- rust/ql/lib/codeql/rust/internal/PathResolution.qll | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rust/ql/lib/codeql/rust/internal/PathResolution.qll b/rust/ql/lib/codeql/rust/internal/PathResolution.qll index 91d7e87704c6..00257238f213 100644 --- a/rust/ql/lib/codeql/rust/internal/PathResolution.qll +++ b/rust/ql/lib/codeql/rust/internal/PathResolution.qll @@ -764,6 +764,10 @@ private predicate crateDependencyEdge(ModuleLikeNode m, string name, CrateItemNo // entry/transitive source file m = c.getASourceFile() ) + or + // paths inside the crate graph use the name of the crate itself as prefix, + // although that is not valid in Rust + dep = any(Crate c | name = c.getName() and m = c.getModule()) } private predicate useTreeDeclares(UseTree tree, string name) {