summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/deaggregator_test_enum_2.rs
blob: 955c317324aa8418059bfc7635dda5521e825df8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// unit-test: Deaggregator
// Test that deaggregate fires in more than one basic block

enum Foo {
    A(i32),
    B(i32),
}

// EMIT_MIR deaggregator_test_enum_2.test1.Deaggregator.diff
fn test1(x: bool, y: i32) -> Foo {
    if x {
        Foo::A(y)
    } else {
        Foo::B(y)
    }
}

fn main() {
    // Make sure the function actually gets instantiated.
    test1(false, 0);
}