You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enumEnum{A,B,C,}fnmain(){matchEnum::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.
Hi! This is currently working as intended, and changing this would be a language change. Additions or changes to the language need to go through our RFC process. Before an RFC is written, the feature can also be discussed in our internals forum to find other people interested in it.
It seems like the following should compile
because the inner match only executes on
A
andB
. But exhaustiveness is checked over the whole enum even though only a subset of variants are possible in this context.Maybe related: #8391
The text was updated successfully, but these errors were encountered: