From ea1b0a8476a555be205cac9a7cc57f4772c604c8 Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum Date: Tue, 2 Dec 2025 14:43:28 +0100 Subject: [PATCH] Rust: Fix path resolution for raw pointer types --- rust/ql/lib/codeql/rust/internal/PathResolution.qll | 7 +++++-- .../CONSISTENCY/PathResolutionConsistency.expected | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rust/ql/lib/codeql/rust/internal/PathResolution.qll b/rust/ql/lib/codeql/rust/internal/PathResolution.qll index 13e1e0d381d..2b9cd42105c 100644 --- a/rust/ql/lib/codeql/rust/internal/PathResolution.qll +++ b/rust/ql/lib/codeql/rust/internal/PathResolution.qll @@ -774,8 +774,11 @@ private TypeItemNode resolveBuiltin(TypeRepr tr) { tr instanceof RefTypeRepr and result instanceof Builtins::RefType or - tr instanceof PtrTypeRepr and - result instanceof Builtins::PtrType + tr.(PtrTypeRepr).isConst() and + result instanceof Builtins::PtrConstType + or + tr.(PtrTypeRepr).isMut() and + result instanceof Builtins::PtrMutType or result.(Builtins::TupleType).getArity() = tr.(TupleTypeRepr).getNumberOfFields() } diff --git a/rust/ql/test/library-tests/type-inference/CONSISTENCY/PathResolutionConsistency.expected b/rust/ql/test/library-tests/type-inference/CONSISTENCY/PathResolutionConsistency.expected index 74a86d6a01d..16db4f5c090 100644 --- a/rust/ql/test/library-tests/type-inference/CONSISTENCY/PathResolutionConsistency.expected +++ b/rust/ql/test/library-tests/type-inference/CONSISTENCY/PathResolutionConsistency.expected @@ -11,6 +11,3 @@ multipleCallTargets | main.rs:2642:13:2642:31 | ...::from(...) | | main.rs:2643:13:2643:31 | ...::from(...) | | main.rs:2644:13:2644:31 | ...::from(...) | -multiplePathResolutions -| main.rs:1818:26:1818:33 | <...> | -| main.rs:1819:17:1819:26 | <...> |