]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/dest-prop/union.rs
Merge commit '35d9c6bf256968e1b40e0d554607928bdf9cebea' into sync_cg_clif-2022-02-23
[rust.git] / src / test / mir-opt / dest-prop / union.rs
1 //! Tests that projections through unions cancel `DestinationPropagation`.
2 // compile-flags: -Zunsound-mir-opts
3 fn val() -> u32 {
4     1
5 }
6
7 // EMIT_MIR union.main.DestinationPropagation.diff
8 fn main() {
9     union Un {
10         us: u32,
11     }
12
13     let un = Un { us: val() };
14
15     drop(unsafe { un.us });
16 }