2023-10-16 12:36:39 -05:00
|
|
|
// skip-filecheck
|
2023-06-08 02:18:34 -05:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2022-08-17 21:13:37 -05:00
|
|
|
//! Tests that we can propagate into places that are projections into unions
|
2024-04-14 20:22:35 -05:00
|
|
|
//@ compile-flags: -Zunsound-mir-opts -C debuginfo=full
|
2020-05-24 14:37:09 -05:00
|
|
|
fn val() -> u32 {
|
|
|
|
1
|
|
|
|
}
|
|
|
|
|
2020-09-12 08:10:51 -05:00
|
|
|
// EMIT_MIR union.main.DestinationPropagation.diff
|
2020-05-24 14:37:09 -05:00
|
|
|
fn main() {
|
2024-06-26 12:39:37 -05:00
|
|
|
// CHECK-LABEL: fn args(
|
|
|
|
// CHECK: {{_.*}} = Un { us: const 1_u32 };
|
2020-05-24 14:37:09 -05:00
|
|
|
union Un {
|
|
|
|
us: u32,
|
|
|
|
}
|
|
|
|
|
|
|
|
let un = Un { us: val() };
|
|
|
|
|
|
|
|
drop(unsafe { un.us });
|
|
|
|
}
|