1 #![feature(never_type)]
2 #![deny(unreachable_patterns)]
5 struct NonEmptyStruct(bool
); //~ `NonEmptyStruct` defined here
6 union NonEmptyUnion1
{ //~ `NonEmptyUnion1` defined here
9 union NonEmptyUnion2
{ //~ `NonEmptyUnion2` defined here
13 enum NonEmptyEnum1
{ //~ `NonEmptyEnum1` defined here
18 enum NonEmptyEnum2
{ //~ `NonEmptyEnum2` defined here
26 enum NonEmptyEnum5
{ //~ `NonEmptyEnum5` defined here
30 macro_rules
! match_empty
{
35 macro_rules
! match_false
{
44 match_empty
!(x
); // ok
45 match_false
!(x
); // Not detected as unreachable nor exhaustive.
46 //~^ ERROR non-exhaustive patterns: `_` not covered
48 _
=> {}
, // Not detected as unreachable, see #55123.
53 // `exhaustive_patterns` is not on, so uninhabited branches are not detected as unreachable.
64 //~^ ERROR type `u8` is non-empty
65 match_empty
!(NonEmptyStruct(true));
66 //~^ ERROR type `NonEmptyStruct` is non-empty
67 match_empty
!((NonEmptyUnion1 { foo: () }
));
68 //~^ ERROR type `NonEmptyUnion1` is non-empty
69 match_empty
!((NonEmptyUnion2 { foo: () }
));
70 //~^ ERROR type `NonEmptyUnion2` is non-empty
71 match_empty
!(NonEmptyEnum1
::Foo(true));
72 //~^ ERROR `Foo(_)` not covered
73 match_empty
!(NonEmptyEnum2
::Foo(true));
74 //~^ ERROR `Foo(_)` and `Bar` not covered
75 match_empty
!(NonEmptyEnum5
::V1
);
76 //~^ ERROR `V1`, `V2`, `V3` and 2 more not covered
79 //~^ ERROR `_` not covered
80 match_false
!(NonEmptyStruct(true));
81 //~^ ERROR `NonEmptyStruct(_)` not covered
82 match_false
!((NonEmptyUnion1 { foo: () }
));
83 //~^ ERROR `NonEmptyUnion1 { .. }` not covered
84 match_false
!((NonEmptyUnion2 { foo: () }
));
85 //~^ ERROR `NonEmptyUnion2 { .. }` not covered
86 match_false
!(NonEmptyEnum1
::Foo(true));
87 //~^ ERROR `Foo(_)` not covered
88 match_false
!(NonEmptyEnum2
::Foo(true));
89 //~^ ERROR `Foo(_)` and `Bar` not covered
90 match_false
!(NonEmptyEnum5
::V1
);
91 //~^ ERROR `V1`, `V2`, `V3` and 2 more not covered