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