rust/tests/mir-opt/dest-prop/union.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
305 B
Rust
Raw Normal View History

//! Tests that we can propagate into places that are projections into unions
// compile-flags: -Zunsound-mir-opts
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() {
union Un {
us: u32,
}
let un = Un { us: val() };
drop(unsafe { un.us });
}