1 //@compile-flags: -Zmiri-permissive-provenance
4 // Cast a function pointer such that on a call, the argument gets transmuted
5 // from raw ptr to reference. This is ABI-compatible, so it's not the call that
6 // should fail, but validation should.
9 let g: fn(*const i32) = unsafe { std::mem::transmute(f as fn(&i32)) };
11 g(0usize as *const i32)
12 //~^ ERROR: encountered a null reference