Skip to content

fix: don't offer replace_qualified_name_with_use on an unqualified path - #22919

Merged
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
shulaoda:07-26-fix_don_t_offer_replace_qualified_name_with_use_on_an_unqualified_path
Jul 26, 2026
Merged

fix: don't offer replace_qualified_name_with_use on an unqualified path#22919
ChayimFriedman2 merged 1 commit into
rust-lang:masterfrom
shulaoda:07-26-fix_don_t_offer_replace_qualified_name_with_use_on_an_unqualified_path

Conversation

@shulaoda

Copy link
Copy Markdown
Contributor

Closes #22691

When a crate and an item inside it share a name, sub() resolves to the crate in the type namespace, so the assist is offered on a path that has no qualifier at all. It then imports the crate itself (use sub;) and leaves the call untouched, which is a no-op edit on code that does not compile either way. There is nothing to replace here, so the assist should not be offered.

🤖 AI-assisted: understanding the issue, locating the cause, and writing the test.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 26, 2026

@ChayimFriedman2 ChayimFriedman2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChayimFriedman2
ChayimFriedman2 added this pull request to the merge queue Jul 26, 2026
Merged via the queue into rust-lang:master with commit b59f59f Jul 26, 2026
18 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Code action Replace qualified path with use resolves incorrectly when item name matches crate name

3 participants