summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/dest-prop/union.rs
blob: 4bc6f28c6c297f4a1e588cb451c608de6d78a093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
//! Tests that we can propagate into places that are projections into unions
// compile-flags: -Zunsound-mir-opts
fn val() -> u32 {
    1
}

// EMIT_MIR union.main.DestinationPropagation.diff
fn main() {
    union Un {
        us: u32,
    }

    let un = Un { us: val() };

    drop(unsafe { un.us });
}