-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
struct Shadowed {}
fn make_index() {
let v = Shadowed::Foo;
match v {}
enum Shadowed {
Foo,
}
}
fn main() {}
Current output
Compiling playground v0.0.1 (/playground)
error[E0004]: non-exhaustive patterns: `make_index::Shadowed::Foo` not covered
--> src/main.rs:6:11
|
6 | match v {}
| ^ pattern `make_index::Shadowed::Foo` not covered
|
note: `make_index::Shadowed` defined here
--> src/main.rs:8:10
|
8 | enum Shadowed {
| ^^^^^^^^
9 | Foo,
| --- not covered
= note: the matched value is of type `make_index::Shadowed`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
6 ~ match v {
7 + make_index::Shadowed::Foo => todo!(),
8 ~ }
|
For more information about this error, try `rustc --explain E0004`.
error: could not compile `playground` (bin "playground") due to 1 previous error
Desired output
Compiling playground v0.0.1 (/playground)
error[E0004]: non-exhaustive patterns: `Shadowed::Foo` not covered
--> src/main.rs:6:11
|
6 | match v {}
| ^ pattern `Shadowed::Foo` not covered
|
note: `make_index::Shadowed` defined here
--> src/main.rs:8:10
|
8 | enum Shadowed {
| ^^^^^^^^
9 | Foo,
| --- not covered
= note: the matched value is of type `Shadowed`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
6 ~ match v {
7 + Shadowed::Foo => todo!(),
8 ~ }
|
For more information about this error, try `rustc --explain E0004`.
error: could not compile `playground` (bin "playground") due to 1 previous error
Rationale and extra context
Unsure if make_index
should be dropped from the name of the enum, but it definitely needs to be removed from the code suggestion, since it's not needed, and causes an error.
Other cases
Rust Version
1.87.0-nightly
(2025-02-25 85abb276361c424d6474)
(I'm testing this on the playground, and it happens for all of stable, beta, nightly there)
Anything else?
No response
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.