rust-lang / rust-lang/rust

ICE: suggestion must not have overlapping parts `E0599`

Open
#130,395 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics C-bug D-invalid-suggestion I-ICE requires-debug-assertions S-bug-has-test T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
enum U {
    B(isize, usize),
}

fn main() {
    let x = T::A(U::C);
}
Meta

rustc --version --verbose:

rustc 1.83.0-nightly (9b72238eb 2024-09-14)
binary: rustc
commit-hash: 9b72238eb813e9d06e9e9d270168512fbffd7ee7
commit-date: 2024-09-14
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0
Error output
error[E0433]: failed to resolve: use of undeclared type `T`
 --> k.rs:6:13
  |
6 |     let x = T::A(U::C);
  |             ^
  |             |
  |             use of undeclared type `T`
  |             help: an enum with a similar name exists: `U`

error[E0599]: no variant or associated item named `C` found for enum `U` in the current scope
 --> k.rs:6:21
  |
1 | enum U {
  | ------ variant or associated item `C` not found for this enum
...
6 |     let x = T::A(U::C);
  |                     ^ variant or associated item not found in `U`
  |
help: there is a variant with a similar name
  |
6 |     let x = T::A(/* isize */, /* usize */B);
  |                  ~~~~~~~~~~~~~~~~~~~~~~~~

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the minimal Rust example from the issue with the reported nightly compiler and inspect the E0599 diagnostic suggestion output. Trace the compiler's suggestion generation for the missing enum variant; done means the suggestion no longer contains overlapping parts and a regression test covers this example.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.