diff options
Diffstat (limited to 'tests/mir-opt/deaggregator_test_enum_2.rs')
-rw-r--r-- | tests/mir-opt/deaggregator_test_enum_2.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/mir-opt/deaggregator_test_enum_2.rs b/tests/mir-opt/deaggregator_test_enum_2.rs new file mode 100644 index 000000000..955c31732 --- /dev/null +++ b/tests/mir-opt/deaggregator_test_enum_2.rs @@ -0,0 +1,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); +} |