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
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
h-dv/code-index#348
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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:
The cost on rust-ripgrep. Only about 13 of 30 sampled dropped binds were wrong. The correct ones that are now lost include:
ig.matchedandov.matchedin 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:
recv_binds) to Rustletbindings with an explicit type or aT::new()/T { … }initializer, and to typed parameters;Related: #336, #188.
.nameon an untyped receiver binds "resolved" to the only in-projectdef name(phantom edges into context_pack / change_impact / safe_delete) #336Released in v0.36.0. Builder chains, struct literals,
T::new(), typed parameters andcrate::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