]> git.proxmox.com Git - rustc.git/blob - src/test/ui/never_type/issue-44402.rs
New upstream version 1.40.0+dfsg1
[rustc.git] / src / test / ui / never_type / issue-44402.rs
1 // check-pass
2
3 #![allow(dead_code)]
4 #![feature(never_type)]
5 #![feature(exhaustive_patterns)]
6
7 // Regression test for inhabitedness check. The old
8 // cache used to cause us to incorrectly decide
9 // that `test_b` was invalid.
10
11 struct Foo {
12 field1: !,
13 field2: Option<&'static Bar>,
14 }
15
16 struct Bar {
17 field1: &'static Foo
18 }
19
20 fn test_a() {
21 let x: Option<Foo> = None;
22 match x { None => () }
23 }
24
25 fn test_b() {
26 let x: Option<Bar> = None;
27 match x {
28 Some(_) => (),
29 None => ()
30 }
31 }
32
33 fn main() { }