// run-pass #![allow(dead_code)] use std::mem::{size_of, transmute}; union U1 { a: A, } union U2 { a: A, b: B, } fn main() { // Unions do not participate in niche-filling/non-zero optimization... assert!(size_of::>>() > size_of::>()); assert!(size_of::>>() > size_of::>()); // ...even when theoretically possible: assert!(size_of::>>() > size_of::>()); assert!(size_of::>>() > size_of::>()); // The unused bits of the () variant can have any value. let zeroed: U2<&u8, ()> = unsafe { transmute(std::ptr::null::()) }; if let None = Some(zeroed) { panic!() } }