]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/consts/const-eval/ub-nonnull.rs
Rollup merge of #70038 - DutchGhost:const-forget-tests, r=RalfJung
[rust.git] / src / test / ui / consts / const-eval / ub-nonnull.rs
index 8ce64ced7dff4c02b004fb6d8637e94d82e2086a..1f46b6c98ad2fad012095465feb98417bdf193f2 100644 (file)
 //~^ ERROR it is undefined behavior to use this value
 
 #[repr(C)]
-union Transmute {
+union MaybeUninit<T: Copy> {
     uninit: (),
-    out: NonZeroU8,
+    init: T,
 }
-const UNINIT: NonZeroU8 = unsafe { Transmute { uninit: () }.out };
+const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
 //~^ ERROR it is undefined behavior to use this value
 
 // Also test other uses of rustc_layout_scalar_valid_range_start