2 #![feature(never_type)]
3 #![feature(never_type_fallback)]
4 #![deny(unreachable_patterns)]
10 struct NonEmptyStruct(bool); //~ `NonEmptyStruct` defined here
11 union NonEmptyUnion1 { //~ `NonEmptyUnion1` defined here
14 union NonEmptyUnion2 { //~ `NonEmptyUnion2` defined here
18 enum NonEmptyEnum1 { //~ `NonEmptyEnum1` defined here
23 enum NonEmptyEnum2 { //~ `NonEmptyEnum2` defined here
31 enum NonEmptyEnum5 { //~ `NonEmptyEnum5` defined here
35 macro_rules! match_empty {
40 macro_rules! match_false {
48 fn empty_enum(x: EmptyEnum) {
51 _ => {}, //~ ERROR unreachable pattern
54 _ if false => {}, //~ ERROR unreachable pattern
58 fn empty_foreign_enum(x: empty::EmptyForeignEnum) {
61 _ => {}, //~ ERROR unreachable pattern
64 _ if false => {}, //~ ERROR unreachable pattern
71 _ => {}, //~ ERROR unreachable pattern
74 _ if false => {}, //~ ERROR unreachable pattern
79 // `exhaustive_patterns` is not on, so uninhabited branches are not detected as unreachable.
84 match None::<EmptyEnum> {
90 //~^ ERROR type `u8` is non-empty
91 match_empty!(NonEmptyStruct(true));
92 //~^ ERROR type `NonEmptyStruct` is non-empty
93 match_empty!((NonEmptyUnion1 { foo: () }));
94 //~^ ERROR type `NonEmptyUnion1` is non-empty
95 match_empty!((NonEmptyUnion2 { foo: () }));
96 //~^ ERROR type `NonEmptyUnion2` is non-empty
97 match_empty!(NonEmptyEnum1::Foo(true));
98 //~^ ERROR `Foo(_)` not covered
99 match_empty!(NonEmptyEnum2::Foo(true));
100 //~^ ERROR `Foo(_)` and `Bar` not covered
101 match_empty!(NonEmptyEnum5::V1);
102 //~^ ERROR `V1`, `V2`, `V3` and 2 more not covered
105 //~^ ERROR `_` not covered
106 match_false!(NonEmptyStruct(true));
107 //~^ ERROR `NonEmptyStruct(_)` not covered
108 match_false!((NonEmptyUnion1 { foo: () }));
109 //~^ ERROR `NonEmptyUnion1 { .. }` not covered
110 match_false!((NonEmptyUnion2 { foo: () }));
111 //~^ ERROR `NonEmptyUnion2 { .. }` not covered
112 match_false!(NonEmptyEnum1::Foo(true));
113 //~^ ERROR `Foo(_)` not covered
114 match_false!(NonEmptyEnum2::Foo(true));
115 //~^ ERROR `Foo(_)` and `Bar` not covered
116 match_false!(NonEmptyEnum5::V1);
117 //~^ ERROR `V1`, `V2`, `V3` and 2 more not covered