Refined error message.
More human-readable error message showing ellipsis for excessively long witness lists.
This commit is contained in:
parent
6100743842
commit
48e8326893
2 changed files with 48 additions and 15 deletions
|
|
@ -16,12 +16,6 @@ struct Foo {
|
|||
second: Option<[usize; 4]>
|
||||
}
|
||||
|
||||
enum Color {
|
||||
Red,
|
||||
Green,
|
||||
CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
|
||||
}
|
||||
|
||||
fn struct_with_a_nested_enum_and_vector() {
|
||||
match (Foo { first: true, second: None }) {
|
||||
//~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
|
||||
|
|
@ -32,13 +26,42 @@ fn struct_with_a_nested_enum_and_vector() {
|
|||
}
|
||||
}
|
||||
|
||||
fn enum_with_multiple_missing_variants() {
|
||||
enum Color {
|
||||
Red,
|
||||
Green,
|
||||
CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
|
||||
}
|
||||
|
||||
fn enum_with_two_missing_variants() {
|
||||
match Color::Red {
|
||||
//~^ ERROR non-exhaustive patterns: `Red`, `Green` not covered
|
||||
//~^ ERROR non-exhaustive patterns: `Red` and `Green` not covered
|
||||
Color::CustomRGBA { .. } => ()
|
||||
}
|
||||
}
|
||||
|
||||
enum Direction {
|
||||
North, East, South, West
|
||||
}
|
||||
|
||||
fn enum_with_three_or_more_missing_variants() {
|
||||
match Direction::North {
|
||||
//~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered
|
||||
Direction::North => ()
|
||||
}
|
||||
}
|
||||
|
||||
enum ExcessiveEnum {
|
||||
First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth
|
||||
}
|
||||
|
||||
fn enum_with_excessive_missing_variants() {
|
||||
match ExcessiveEnum::First {
|
||||
//~^ ERROR `Sixth`, `Seventh`, `Eighth`, `Ninth`, `Tenth`, … and `Twelfth` not covered
|
||||
|
||||
ExcessiveEnum::First => ()
|
||||
}
|
||||
}
|
||||
|
||||
fn enum_struct_variant() {
|
||||
match Color::Red {
|
||||
//~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue