]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/uninhabited_enum_branching2.rs
Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebank
[rust.git] / src / test / mir-opt / uninhabited_enum_branching2.rs
1 enum Empty { }
2
3 // test matching an enum with uninhabited variants
4 enum Test1 {
5     A(Empty),
6     B(Empty),
7     C,
8     D,
9 }
10
11 struct Plop {
12     xx: u32,
13     test1: Test1,
14 }
15
16 // EMIT_MIR uninhabited_enum_branching2.main.UninhabitedEnumBranching.diff
17 // EMIT_MIR uninhabited_enum_branching2.main.SimplifyCfg-after-uninhabited-enum-branching.after.mir
18 fn main() {
19     let plop = Plop { xx: 51, test1: Test1::C };
20
21     match &plop.test1 {
22         Test1::A(_) => "A(Empty)",
23         Test1::B(_) => "B(Empty)",
24         Test1::C => "C",
25         Test1::D => "D",
26     };
27
28     match plop.test1 {
29         Test1::A(_) => "A(Empty)",
30         Test1::B(_) => "B(Empty)",
31         Test1::C => "C",
32         Test1::D => "D",
33     };
34 }