1 #![feature(slice_patterns)]
5 second: Option<[usize; 4]>
8 fn struct_with_a_nested_enum_and_vector() {
9 match (Foo { first: true, second: None }) {
10 //~^ ERROR non-exhaustive patterns: `Foo { first: false, second: Some([_, _, _, _]) }` not covered
11 Foo { first: true, second: None } => (),
12 Foo { first: true, second: Some(_) } => (),
13 Foo { first: false, second: None } => (),
14 Foo { first: false, second: Some([1, 2, 3, 4]) } => ()
21 CustomRGBA { a: bool, r: u8, g: u8, b: u8 }
24 fn enum_with_single_missing_variant() {
26 //~^ ERROR non-exhaustive patterns: `Red` not covered
27 Color::CustomRGBA { .. } => (),
33 North, East, South, West
36 fn enum_with_multiple_missing_variants() {
37 match Direction::North {
38 //~^ ERROR non-exhaustive patterns: `East`, `South` and `West` not covered
39 Direction::North => ()
44 First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth, Eleventh, Twelfth
47 fn enum_with_excessive_missing_variants() {
48 match ExcessiveEnum::First {
49 //~^ ERROR `Second`, `Third`, `Fourth` and 8 more not covered
51 ExcessiveEnum::First => ()
55 fn enum_struct_variant() {
57 //~^ ERROR non-exhaustive patterns: `CustomRGBA { a: true, .. }` not covered
60 Color::CustomRGBA { a: false, r: _, g: _, b: 0 } => (),
61 Color::CustomRGBA { a: false, r: _, g: _, b: _ } => ()
70 fn vectors_with_nested_enums() {
71 let x: &'static [Enum] = &[Enum::First, Enum::Second(false)];
73 //~^ ERROR non-exhaustive patterns: `[Second(true), Second(false)]` not covered
76 [Enum::First, _] => (),
77 [Enum::Second(true), Enum::First] => (),
78 [Enum::Second(true), Enum::Second(true)] => (),
79 [Enum::Second(false), _] => (),
80 [_, _, ref tail @ .., _] => ()
86 //~^ ERROR non-exhaustive patterns: `((), false)` not covered