]> git.lizzy.rs Git - rust.git/blob - union.rs
eb6cb09fc455492d9dcf2201b7565c83382f1316
[rust.git] / union.rs
1 //! Tests that we can propagate into places that are projections into unions
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 }