bugfix(semantic): Fixed suggested crate:: context paths. - #10044
Conversation
PR SummaryLow Risk Overview When the item’s owning crate matches the context module’s crate, Adds a path diagnostics test for ambiguous trait method calls under Reviewed by Cursor Bugbot for commit 8a6e4dd. Bugbot is set up for automated code reviews on this repo. Configure here. |
eytan-starkware
left a comment
There was a problem hiding this comment.
@eytan-starkware reviewed 2 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).

Summary
Fixes a bug where the
crate::path prefix was incorrectly double-encoding the crate name. When resolving a path via the crate root, the crate name was being included inpath_itemsin addition to theViaCratekind prefix, resulting in paths likecrate::my_crate::module::Iteminstead of the correctcrate::module::Item. The fix removes the crate name frompath_itemsbefore constructing theItemAccessInfowhen the owning crate matches the context module's crate.A regression test was added to verify that ambiguous method call diagnostics using
crate::paths display the correct path format (e.g.,crate::provider1::T::foorather than a double-encoded variant).Type of change
Please check one:
Why is this change needed?
When two traits were imported via
use crate::provider::*glob imports and an ambiguous method call occurred, the diagnostic message was generating malformed paths that included the crate name twice — once frompath_itemsand once implicitly from theViaCratekind prefix.What was the behavior or documentation before?
Ambiguous method call diagnostics for items resolved via
crate::would produce incorrectly formed paths, including the crate name redundantly alongside thecrate::prefix.What is the behavior or documentation after?
Ambiguous method call diagnostics correctly display paths in the form
crate::provider1::T::fooandcrate::provider2::T::foo, without duplicating the crate name.Related issue or discussion (if any)
None specified.
Additional context
None.