]> git.lizzy.rs Git - rust.git/blob - src/test/ui/always-inhabited-union-ref.rs
Add a test for uninhabitedness changes
[rust.git] / src / test / ui / always-inhabited-union-ref.rs
1 #![feature(exhaustive_patterns)]
2 #![feature(never_type)]
3
4 #![allow(dead_code)]
5 #![allow(unreachable_code)]
6
7 pub union Foo {
8     foo: !,
9 }
10
11 fn uninhab_ref() -> &'static ! {
12     unimplemented!()
13 }
14
15 fn uninhab_union() -> Foo {
16     unimplemented!()
17 }
18
19 fn match_on_uninhab() {
20     match uninhab_ref() {
21         //~^ ERROR non-exhaustive patterns: type &'static ! is non-empty
22     }
23
24     match uninhab_union() {
25         //~^ ERROR non-exhaustive patterns: type Foo is non-empty
26     }
27 }
28
29 fn main() {}