Closed
Description
#31020 added display of multiple witnesses to the error message for non-exhaustive match patterns. However, witnesses beyond the first one may have inappropriate types. For example:
enum Direction {
North,
East,
South,
West,
}
fn main() {
match Some(Direction::North) {
Some(Direction::North) => (),
None => ()
}
}
Output:
error[E0004]: non-exhaustive patterns: `Some(East)`, `South` and `West` not covered
--> <anon>:9:11
|
9 | match Some(Direction::North) {
| ^^^^^^^^^^^^^^^^^^^^^^ patterns `Some(East)`, `South` and `West` not covered
error: aborting due to previous error
Here, "South
and West
not covered" should read "Some(South)
and Some(West)
not covered".