+// aux-build:empty.rs
#![feature(never_type)]
+#![feature(never_type_fallback)]
#![feature(exhaustive_patterns)]
#![deny(unreachable_patterns)]
-enum Foo {}
+
+extern crate empty;
+
+enum EmptyEnum {}
struct NonEmptyStruct(bool); //~ `NonEmptyStruct` defined here
union NonEmptyUnion1 { //~ `NonEmptyUnion1` defined here
};
}
-fn foo(x: Foo) {
- match_empty!(x); // ok
+fn empty_enum(x: EmptyEnum) {
+ match x {} // ok
+ match x {
+ _ => {}, //~ ERROR unreachable pattern
+ }
+ match x {
+ _ if false => {}, //~ ERROR unreachable pattern
+ }
+}
+
+fn empty_foreign_enum(x: empty::EmptyForeignEnum) {
+ match x {} // ok
+ match x {
+ _ => {}, //~ ERROR unreachable pattern
+ }
+ match x {
+ _ if false => {}, //~ ERROR unreachable pattern
+ }
+}
+
+fn never(x: !) {
+ match x {} // ok
match x {
_ => {}, //~ ERROR unreachable pattern
}
None => {}
Some(_) => {} //~ ERROR unreachable pattern
}
- match None::<Foo> {
+ match None::<EmptyEnum> {
None => {}
Some(_) => {} //~ ERROR unreachable pattern
}