Closed
Description
It seems like the following should compile
enum Enum {
A,
B,
C,
}
fn main() {
match Enum::A {
x @ Enum::A | x @ Enum::B => match x {
Enum::A => println!("a"),
Enum::B => println!("b"),
// _ => unreachable!(), // Won't compile without this line
}
Enum::C => println!("c"),
}
}
because the inner match only executes on A
and B
. But exhaustiveness is checked over the whole enum even though only a subset of variants are possible in this context.
Maybe related: #8391
Metadata
Metadata
Assignees
Labels
No labels