Skip to content

Do not continue past rustc_resolve when encountering duplicated items - #162831

Open
estebank wants to merge 1 commit into
rust-lang:mainfrom
estebank:duplicated-items
Open

estebank wants to merge 1 commit into
rust-lang:mainfrom
estebank:duplicated-items

Conversation

@estebank

@estebank estebank commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

View all comments

Duplicated items cause lots of confusing knock down errors. This change side-steps some known ICEs, and reduces the verbosity of crates with duplicated items at the cost of not emitting every error that we could.

Noticed just how problematic these can be while looking at #160695, as #[derive]s are particularly prone to the kind of confusion these duplicates cause.

Fix #120873, fix #123690.

r? @petrochenkov

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 15, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@estebank
estebank force-pushed the duplicated-items branch 2 times, most recently from 9cc7001 to dd5e174 Compare September 16, 2026 19:16
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@estebank

Copy link
Copy Markdown
Contributor Author

CC @oli-obk as we spent a lot of time some years back removing Fatal.raise() as much as possible, and this is a partial walk-back.

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_resolve/src/diagnostics/impls.rs Outdated
@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 18, 2026
@rust-log-analyzer

This comment has been minimized.

@estebank estebank added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2026
@rust-bors

This comment has been minimized.

@rustbot

This comment has been minimized.

Comment thread compiler/rustc_resolve/src/diagnostics/impls.rs Outdated
@petrochenkov

Copy link
Copy Markdown
Contributor

r=me after addressing #162831 (comment).
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 20, 2026
@rustbot

rustbot commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@estebank

Copy link
Copy Markdown
Contributor Author

@bors r=petrochenkov

@rust-bors

rust-bors Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 504b381 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 20, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Sep 20, 2026
Duplicated items cause lots of confusing knock down errors. This change side-steps some known ICEs, and reduces the verbosity of crates with duplicated types at the cost of not emitting every error that we could.

Update tests that no longer crash:

120873 -> `tests/ui/resolve/multiple_definitions_attribute_merging.rs`
          (already existing)
123690 -> `tests/ui/resolve/duplicated-enum-variant.rs`
155482 -> `tests/ui/resolve/duplicated-item-in-const-generics.rs`
	  Added two cases from the report that still ICE.
@rustbot

rustbot commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@estebank

Copy link
Copy Markdown
Contributor Author

@bors r=petrochenkov

@rust-bors

rust-bors Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 28fe133 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 21, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 21, 2026
…chenkov

Do not continue past `rustc_resolve` when encountering duplicated items

Duplicated items cause *lots* of confusing knock down errors. This change side-steps some known ICEs, and reduces the verbosity of crates with duplicated items at the cost of not emitting every error that we could.

Noticed just how problematic these can be while looking at rust-lang#160695, as `#[derive]`s are particularly prone to the kind of confusion these duplicates cause.

Fix rust-lang#120873, fix rust-lang#123690.

r? @petrochenkov
rust-bors Bot pushed a commit that referenced this pull request Sep 21, 2026
Rollup of 15 pull requests

Successful merges:

 - #161051 (When error from local macro, include macro def span)
 - #162750 (add case mapping fast paths for Latin-1)
 - #162831 (Do not continue past `rustc_resolve` when encountering duplicated items)
 - #162835 (rustdoc: account for nested parens and split text events in bare urls lint)
 - #163044 (Report runtime range endpoints for runtime values)
 - #163062 (Use x30 register name with LLVM 23+)
 - #158102 (When compiling without a specified `--edition`, emit a note)
 - #162984 (Windows: don't error if `access_mode` is set on `OpenOptions`)
 - #163005 (Avoid unreachable integer underflow check in `CStr::count_bytes()`)
 - #163019 (Prepare for the introduction of forced keywords (`k#`))
 - #163020 (Dir: fix fallback impl for remove_dir)
 - #163047 (Use verbose suggestion for `mut binding` instead of `&mut binding`)
 - #163075 (Fix ArgAttributes mismatches in ABI UI tests for LoongArch64 and RiscV64)
 - #163079 (enable `f128` from `u64`/`i64` test)
 - #163082 (Remove `TypeChecker::root_cx`)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 21, 2026
…chenkov

Do not continue past `rustc_resolve` when encountering duplicated items

Duplicated items cause *lots* of confusing knock down errors. This change side-steps some known ICEs, and reduces the verbosity of crates with duplicated items at the cost of not emitting every error that we could.

Noticed just how problematic these can be while looking at rust-lang#160695, as `#[derive]`s are particularly prone to the kind of confusion these duplicates cause.

Fix rust-lang#120873, fix rust-lang#123690.

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

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: Unsigned value 0x100 does not fit in 8 bits ICE: builtin derive created an unaligned reference

4 participants