Rust recall cost of #336: captured receivers in test modules / typed let-bindings lose correct proximity binds (ripgrep ~57% of dropped binds were correct) #348

Closed
opened 2026-10-09 10:19:43 +02:00 by buildagent · 1 comment
Member

This is a follow-up to #336. The operator approved shipping #336 in v0.35, accepting this cost knowingly.

What #336 changes. It forbids same-file (tier 2) and same-directory (tier 3) proximity from CHOOSING the target of a call on a named, non-self receiver of unknown type. This applies in every language. Where precision was measured, most of the binds it drops were wrong:

  • python-flask: about 100%;
  • Ruby: about 75–87%;
  • Python and TypeScript: about 75–90%.

The cost on rust-ripgrep. Only about 13 of 30 sampled dropped binds were wrong. The correct ones that are now lost include:

  • ig.matched and ov.matched in test modules;
  • printer.sink_with_path.

The receiver's type is often visible in Rust, from a typed let x: T, a constructor call (T::new()), or a function parameter type. Proximity was standing in for the type evidence the resolver doesn't read.

Proposal. Recover these through TYPE evidence, not proximity:

  • extend the receiver-typing tier (tier1R / recv_binds) to Rust let bindings with an explicit type or a T::new() / T { … } initializer, and to typed parameters;
  • measure the recovered binds against the #336 drop list on ripgrep and rust-analyzer;
  • every gain must be checked at its source.

Related: #336, #188.

This is a follow-up to #336. The operator approved shipping #336 in v0.35, accepting this cost knowingly. **What #336 changes.** It forbids same-file (tier 2) and same-directory (tier 3) proximity from CHOOSING the target of a call on a named, non-self receiver of unknown type. This applies in every language. Where precision was measured, most of the binds it drops were wrong: - python-flask: about 100%; - Ruby: about 75–87%; - Python and TypeScript: about 75–90%. **The cost on rust-ripgrep.** Only about 13 of 30 sampled dropped binds were wrong. The correct ones that are now lost include: - `ig.matched` and `ov.matched` in test modules; - `printer.sink_with_path`. The receiver's type is often visible in Rust, from a typed `let x: T`, a constructor call (`T::new()`), or a function parameter type. Proximity was standing in for the type evidence the resolver doesn't read. **Proposal.** Recover these through TYPE evidence, not proximity: - extend the receiver-typing tier (tier1R / `recv_binds`) to Rust `let` bindings with an explicit type or a `T::new()` / `T { … }` initializer, and to typed parameters; - measure the recovered binds against the #336 drop list on ripgrep and rust-analyzer; - every gain must be checked at its source. Related: #336, #188.
Author
Member

Released in v0.36.0. Builder chains, struct literals, T::new(), typed parameters and crate:: paths now type a variable. Measured +147 resolved references on rust-ripgrep and +1,954 on rust-analyzer. Schema v81 re-extracts Rust files once. de.h-dv.rust 0.1.2 is rebuilt from it.

🤖 Generated with Claude Code

Released in v0.36.0. Builder chains, struct literals, `T::new()`, typed parameters and `crate::` paths now type a variable. Measured +147 resolved references on rust-ripgrep and +1,954 on rust-analyzer. Schema v81 re-extracts Rust files once. de.h-dv.rust 0.1.2 is rebuilt from it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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#348
No description provided.