]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/deaggregator_test_multiple.rs
Auto merge of #55519 - fhartwig:hashmap-index-example, r=Centril
[rust.git] / src / test / mir-opt / deaggregator_test_multiple.rs
1 // Test that deaggregate fires more than once per block
2
3 enum Foo {
4     A(i32),
5     B,
6 }
7
8 fn test(x: i32) -> [Foo; 2] {
9     [Foo::A(x), Foo::A(x)]
10 }
11
12 fn main() {
13     // Make sure the function actually gets instantiated.
14     test(0);
15 }
16
17 // END RUST SOURCE
18 // START rustc.test.Deaggregator.before.mir
19 // bb0: {
20 //     ...
21 //     _3 = _1;
22 //     ...
23 //     _2 = Foo::A(move _3,);
24 //     ...
25 //     _5 = _1;
26 //     _4 = Foo::A(move _5,);
27 //     ...
28 //     _0 = [move _2, move _4];
29 //     ...
30 //     return;
31 // }
32 // END rustc.test.Deaggregator.before.mir
33 // START rustc.test.Deaggregator.after.mir
34 // bb0: {
35 //     ...
36 //     _3 = _1;
37 //     ...
38 //     ((_2 as A).0: i32) = move _3;
39 //     discriminant(_2) = 0;
40 //     ...
41 //     _5 = _1;
42 //     ((_4 as A).0: i32) = move _5;
43 //     discriminant(_4) = 0;
44 //     ...
45 //     _0 = [move _2, move _4];
46 //     ...
47 //     return;
48 // }
49 // END rustc.test.Deaggregator.after.mir