-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code (playground link):
#[derive(PartialEq)]
struct Opaque(i32);
impl Eq for Opaque {}
const FOO: Opaque = Opaque(42);
fn foo() {
match Opaque(0) {
FOO => {},
_ => {}
}
}
This emits an "unreachable pattern" warning on the second branch of the match, even though it is clearly reachable. This gives the same warning for current nightly and beta, as well as stable 1.47.0 and 1.40.0.
This was uncovered while discussing #77390.
Meta
rustc --version --verbose
:
rustc 1.47.0 (18bf6b4f0 2020-10-07)
binary: rustc
commit-hash: 18bf6b4f01a6feaf7259ba7cdae58031af1b7b39
commit-date: 2020-10-07
host: x86_64-unknown-linux-gnu
release: 1.47.0
LLVM version: 11.0
Metadata
Metadata
Assignees
Labels
A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsRelating to exhaustiveness / usefulness checking of patternsC-bugCategory: This is a bug.Category: This is a bug.