1 #![feature(never_type)]
2 #![feature(exhaustive_patterns)]
3 #![deny(unreachable_patterns)]
6 struct NonEmptyStruct(bool); //~ `NonEmptyStruct` defined here
7 union NonEmptyUnion1 { //~ `NonEmptyUnion1` defined here
10 union NonEmptyUnion2 { //~ `NonEmptyUnion2` defined here
14 enum NonEmptyEnum1 { //~ `NonEmptyEnum1` defined here
19 enum NonEmptyEnum2 { //~ `NonEmptyEnum2` defined here
27 enum NonEmptyEnum5 { //~ `NonEmptyEnum5` defined here
31 macro_rules! match_empty {
36 macro_rules! match_false {
45 match_empty!(x); // ok
47 _ => {}, //~ ERROR unreachable pattern
50 _ if false => {}, //~ ERROR unreachable pattern
57 Some(_) => {} //~ ERROR unreachable pattern
61 Some(_) => {} //~ ERROR unreachable pattern
65 //~^ ERROR type `u8` is non-empty
66 match_empty!(NonEmptyStruct(true));
67 //~^ ERROR type `NonEmptyStruct` is non-empty
68 match_empty!((NonEmptyUnion1 { foo: () }));
69 //~^ ERROR type `NonEmptyUnion1` is non-empty
70 match_empty!((NonEmptyUnion2 { foo: () }));
71 //~^ ERROR type `NonEmptyUnion2` is non-empty
72 match_empty!(NonEmptyEnum1::Foo(true));
73 //~^ ERROR `Foo(_)` not covered
74 match_empty!(NonEmptyEnum2::Foo(true));
75 //~^ ERROR `Foo(_)` and `Bar` not covered
76 match_empty!(NonEmptyEnum5::V1);
77 //~^ ERROR `V1`, `V2`, `V3` and 2 more not covered
80 //~^ ERROR `_` not covered
81 match_false!(NonEmptyStruct(true));
82 //~^ ERROR `NonEmptyStruct(_)` not covered
83 match_false!((NonEmptyUnion1 { foo: () }));
84 //~^ ERROR `NonEmptyUnion1 { .. }` not covered
85 match_false!((NonEmptyUnion2 { foo: () }));
86 //~^ ERROR `NonEmptyUnion2 { .. }` not covered
87 match_false!(NonEmptyEnum1::Foo(true));
88 //~^ ERROR `Foo(_)` not covered
89 match_false!(NonEmptyEnum2::Foo(true));
90 //~^ ERROR `Foo(_)` and `Bar` not covered
91 match_false!(NonEmptyEnum5::V1);
92 //~^ ERROR `V1`, `V2`, `V3` and 2 more not covered