// issue-49296: Unsafe shenigans in constants can result in missing errors #![feature(const_fn_union)] #![feature(const_fn_trait_bound)] const unsafe fn transmute(t: T) -> U { #[repr(C)] union Transmute { from: T, to: U, } Transmute { from: t }.to } const fn wat(x: u64) -> &'static u64 { unsafe { transmute(&x) } } const X: u64 = *wat(42); //~^ ERROR any use of this value will cause an error //~| WARN this was previously accepted by the compiler but is being phased out fn main() { println!("{}", X); }