diff options
Diffstat (limited to 'src/test/mir-opt/dest-prop/union.rs')
-rw-r--r-- | src/test/mir-opt/dest-prop/union.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/mir-opt/dest-prop/union.rs b/src/test/mir-opt/dest-prop/union.rs new file mode 100644 index 000000000..68c834dfb --- /dev/null +++ b/src/test/mir-opt/dest-prop/union.rs @@ -0,0 +1,16 @@ +//! Tests that we can propogate 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 }); +} |