Skip to content

fix(E0603): suggest splitting grouped imports with private items#158445

Open
raushan728 wants to merge 2 commits into
rust-lang:mainfrom
raushan728:issues/157453
Open

fix(E0603): suggest splitting grouped imports with private items#158445
raushan728 wants to merge 2 commits into
rust-lang:mainfrom
raushan728:issues/157453

Conversation

@raushan728

@raushan728 raushan728 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

After PR #156244 removed broken suggestions for nested imports, E0603 was left without any suggestion. This restores helpful suggestions for grouped use statements.

For use crate::two::{One, Two} with a private One:

  + use crate::one::One;
  ~ use crate::two::Two;

Single item groups get a direct replacement. Braces are removed when one item remains. Re-export chains are handled.

Fixes #157453.

r? @petrochenkov

Add suggestion for E0603 in grouped use statements.
When a private item is inside , suggest a new import line
with the correct path and remove the item from the group.
Single-item groups get a full-line replacement instead.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 26, 2026
@rustbot

rustbot commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

r? @jackh726

rustbot has assigned @jackh726.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

@rustbot rustbot assigned petrochenkov and unassigned jackh726 Jun 26, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

I reviewed everything except the compiler/rustc_resolve/src/error_helper.rs part, which is full of byte pos arithmetics and other wonders.

r? @fee1-dead please review, since you wanted this.

@rustbot rustbot assigned fee1-dead and unassigned petrochenkov Jun 29, 2026
@rustbot

rustbot commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

fee1-dead is not on the review rotation at the moment.
They may take a while to respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E0603: import directly/through re-export should attach good suggestions for grouped imports

5 participants