]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/deaggregator_test_enum.rs
Rollup merge of #68487 - 0dvictor:nolink, r=tmandry
[rust.git] / src / test / mir-opt / deaggregator_test_enum.rs
1 enum Baz {
2     Empty,
3     Foo { x: usize },
4 }
5
6 fn bar(a: usize) -> Baz {
7     Baz::Foo { x: a }
8 }
9
10 fn main() {
11     let x = bar(10);
12     match x {
13         Baz::Empty => println!("empty"),
14         Baz::Foo { x } => println!("{}", x),
15     };
16 }
17
18 // END RUST SOURCE
19 // START rustc.bar.Deaggregator.before.mir
20 // bb0: {
21 //     StorageLive(_2);
22 //     _2 = _1;
23 //     _0 = Baz::Foo { x: move _2 };
24 //     StorageDead(_2);
25 //     return;
26 // }
27 // END rustc.bar.Deaggregator.before.mir
28 // START rustc.bar.Deaggregator.after.mir
29 // bb0: {
30 //     StorageLive(_2);
31 //     _2 = _1;
32 //     ((_0 as Foo).0: usize) = move _2;
33 //     discriminant(_0) = 1;
34 //     StorageDead(_2);
35 //     return;
36 // }
37 // END rustc.bar.Deaggregator.after.mir