]> git.lizzy.rs Git - rust.git/blob - tests/mir-opt/deaggregator_test_enum_2.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / mir-opt / deaggregator_test_enum_2.rs
1 // unit-test: Deaggregator
2 // Test that deaggregate fires in more than one basic block
3
4 enum Foo {
5     A(i32),
6     B(i32),
7 }
8
9 // EMIT_MIR deaggregator_test_enum_2.test1.Deaggregator.diff
10 fn test1(x: bool, y: i32) -> Foo {
11     if x {
12         Foo::A(y)
13     } else {
14         Foo::B(y)
15     }
16 }
17
18 fn main() {
19     // Make sure the function actually gets instantiated.
20     test1(false, 0);
21 }