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