You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust: a receiver of a non-std crate type binds a same-named project method (the #2053 guard covers std and seeded crates only) #3007
v0.12.1 release binary, Linux (x64). The guard is unchanged on main @ cdfdf26.
What happened, and what did you expect?
#2339 (for #2053) stops the registry fallback when the Rust LSP places a call on a std or seeded-crate symbol (cbm_pipeline_rust_external_target). A receiver whose type comes from any other crate, such as an ordinary crates.io dependency, gets no LSP target. The textual registry then binds the call by name to a same-named project method of an unrelated type, at 0.55 here. This happens in both resolvers.
Expected: no CALLS edge from bar.id() to a project method of another type when bar is declared as extcrate::Bar, a path rooted in a dependency rather than in crate/self/super or a workspace crate. A project trait method implemented for that type (impl MyTrait for extcrate::Bar) would remain a valid target.
Reproduction
Cargo.toml ([dependencies] extcrate = "1", never built), src/lib.rs declaring the two modules below.
// src/series.rsuse extcrate::Bar;pubstructSlice(pubu32);implSlice{pubfnid(&self) -> u32{self.0}}pubenumSeries{Bars(Bar),}implSeries{/// `bar` is extcrate's Bar: calls Bar::id. Must not bind Slice::id or Series::id.pubfnid(&self) -> u32{matchself{Self::Bars(bar) => bar.id(),}}}
// src/user.rsuse extcrate::Bar;/// Typed parameter of an external crate type. Must not bind a project `id`.pubfntyped_param(bar:&Bar) -> u32{
bar.id()}/// Closure parameter over a slice of an external type. Must not bind a project `id`.pubfnclosure_param(bars:&[Bar]) -> Vec<u32>{
bars.iter().map(|bar| bar.id()).collect()}
Activity