Rust: macro invocations are recorded as plain calls, and bare/module-path calls compete with impl members — one rule: the call shape decides the admissible candidate kinds #385

Closed
opened 2026-10-15 15:38:07 +02:00 by buildagent · 0 comments
Member

Found dogfooding 0.39.0 on this repository. Pre-existing. This is the generalisation of #378, which covered method calls onto receiverless functions.

Observed

  • panic!(…) ×1518 appear as name_fallback_count: 1518 on the guest's fn panic panic handler, which nothing calls.
  • format!(…) ×5110 are reported as ambiguous, as if they could be calls to two struct fields named format.
  • The free fn traits_of (core/src/lang_profile.rs:555) has 0 of 27 calls resolved. All are reported ambiguous against the method ProfileBook::traits_of. That includes bare same-file calls and code_index_core::lang_profile::traits_of(…), which a Rust impl member can never satisfy.
  • The production review found the same shape the other way: local closures named read bind to Lockfile::read.

Rule (Rust)

  • A macro invocation name!(…) can only reach a macro.
  • A bare or module-path call can only reach a free fn, never an impl or trait member. Those need Self::, Type:: or x.f().
  • A method_call can only reach a receiver-taking fn (#378).

Order matters

Macro invocations must be marked first. If impl members are removed from bare-call pools alone, format! would start binding any same-named free fn. That is the phantom effect #378's lane measured: removing a pool competitor made 362 phantoms.

Plan

  • The extractor marks macro invocations; the builtin and the guest must agree.
  • One shape → admissible-kind table in the language profile, applied where #378's refusal already sits.
  • Measure every bind against the corpus and read the losses at source.
Found dogfooding 0.39.0 on this repository. Pre-existing. This is the generalisation of #378, which covered method calls onto receiverless functions. ## Observed - **`panic!(…)` ×1518** appear as `name_fallback_count: 1518` on the guest's `fn panic` panic handler, which nothing calls. - **`format!(…)` ×5110** are reported as `ambiguous`, as if they could be calls to two struct fields named `format`. - **The free fn `traits_of`** (`core/src/lang_profile.rs:555`) has 0 of 27 calls resolved. All are reported `ambiguous` against the method `ProfileBook::traits_of`. That includes bare same-file calls and `code_index_core::lang_profile::traits_of(…)`, which a Rust impl member can never satisfy. - **The production review found the same shape the other way:** local closures named `read` bind to `Lockfile::read`. ## Rule (Rust) - A macro invocation `name!(…)` can only reach a macro. - A bare or module-path `call` can only reach a free fn, never an impl or trait member. Those need `Self::`, `Type::` or `x.f()`. - A `method_call` can only reach a receiver-taking fn (#378). ## Order matters Macro invocations must be marked first. If impl members are removed from bare-call pools alone, `format!` would start binding any same-named free fn. That is the phantom effect #378's lane measured: removing a pool competitor made 362 phantoms. ## Plan - The extractor marks macro invocations; the builtin and the guest must agree. - One shape → admissible-kind table in the language profile, applied where #378's refusal already sits. - Measure every bind against the corpus and read the losses at source.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#385
No description provided.