From 2d545dcd2ae267de39e79d93298fa6bb2a4cc6c8 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Tue, 21 Jul 2026 14:29:37 +0000 Subject: [PATCH] fix(rust): capture abstract trait methods for scope resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fn foo(&self) -> T; (no body) parses as function_signature_item, a grammar node distinct from function_item that RUST_SCOPE_QUERY never captured. An abstract trait method therefore had no Function scope and no declaration, so populateClassOwnedMembers never wired its ownerId to the trait's Class scope — invisible to the CALLS-edge receiver-bound resolution pass even after a receiver's type resolves to the trait correctly. Together with the previous commit's dyn-stripping fix, a call through a &dyn Trait parameter now emits a CALLS edge to the trait's method (#2604). --- gitnexus/src/core/ingestion/languages/rust/query.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gitnexus/src/core/ingestion/languages/rust/query.ts b/gitnexus/src/core/ingestion/languages/rust/query.ts index a0e75f0fa..bef3f1bd7 100644 --- a/gitnexus/src/core/ingestion/languages/rust/query.ts +++ b/gitnexus/src/core/ingestion/languages/rust/query.ts @@ -10,6 +10,7 @@ const RUST_SCOPE_QUERY = ` (enum_item) @scope.class (union_item) @scope.class (function_item) @scope.function +(function_signature_item) @scope.function (closure_expression) @scope.function (block) @scope.block (if_expression) @scope.block @@ -55,6 +56,14 @@ const RUST_SCOPE_QUERY = ` (function_item name: (identifier) @declaration.name) @declaration.function +;; Declarations — trait method signature (required method, no body, +;; e.g. fn foo(self) -> T; inside a trait body). Without this, an abstract +;; trait method is invisible to scope resolution — never owned by its +;; trait's Class scope, so a dyn Trait receiver can never dispatch to +;; it (#2604). +(function_signature_item + name: (identifier) @declaration.name) @declaration.function + ;; Declarations — struct fields (field_declaration name: (field_identifier) @declaration.name