rust/tests/mir-opt/dest-prop/union.rs
Jubilee 4c493db0d9
Rollup merge of #122300 - CastilloDel:master, r=cjgillot
Add FileCheck annotations to mir-opt/dest-prop tests

Part of https://github.com/rust-lang/rust/issues/116971, adds FileCheck annotations to MIR-opt tests in tests/mir-opt/dest-prop.

I would like some feedback. Also, I don't know how to approach `union.rs`.  I couldn't figure out what it is testing.

r? cjgillot
2024-07-13 20:19:45 -07:00

21 lines
455 B
Rust

// skip-filecheck
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we can propagate into places that are projections into unions
//@ compile-flags: -Zunsound-mir-opts -C debuginfo=full
fn val() -> u32 {
1
}
// EMIT_MIR union.main.DestinationPropagation.diff
fn main() {
// CHECK-LABEL: fn args(
// CHECK: {{_.*}} = Un { us: const 1_u32 };
union Un {
us: u32,
}
let un = Un { us: val() };
drop(unsafe { un.us });
}