2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2019-11-28 18:00:00 -06:00
|
|
|
// Checks that `SimplifyArmIdentity` is not applied if enums have incompatible layouts.
|
|
|
|
// Regression test for issue #66856.
|
|
|
|
//
|
2021-03-04 07:35:11 -06:00
|
|
|
//@ compile-flags: -Zmir-opt-level=3
|
2020-04-23 11:25:28 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
2019-11-28 18:00:00 -06:00
|
|
|
|
2023-04-15 18:11:42 -05:00
|
|
|
//@ ignore-test This pass is broken since deaggregation changed
|
2022-08-20 23:47:53 -05:00
|
|
|
|
2019-11-28 18:00:00 -06:00
|
|
|
enum Src {
|
|
|
|
Foo(u8),
|
|
|
|
Bar,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Dst {
|
|
|
|
Foo(u8),
|
|
|
|
}
|
|
|
|
|
2020-07-27 14:22:43 -05:00
|
|
|
// EMIT_MIR simplify_arm_identity.main.SimplifyArmIdentity.diff
|
2019-11-28 18:00:00 -06:00
|
|
|
fn main() {
|
|
|
|
let e: Src = Src::Foo(0);
|
|
|
|
let _: Dst = match e {
|
|
|
|
Src::Foo(x) => Dst::Foo(x),
|
|
|
|
Src::Bar => Dst::Foo(0),
|
|
|
|
};
|
|
|
|
}
|