1 use std::mem; 2 safe(_x: &i32, _y: &mut i32)3pub fn safe(_x: &i32, _y: &mut i32) {} //~ ERROR protect 4 main()5fn main() { 6 let mut x = 0; 7 let xref = &mut x; 8 let xraw: *mut i32 = unsafe { mem::transmute_copy(&xref) }; 9 let xshr = &*xref; 10 // transmute fn ptr around so that we can avoid retagging 11 let safe_raw: fn(x: *const i32, y: *mut i32) = unsafe { 12 mem::transmute::<fn(&i32, &mut i32), _>(safe) 13 }; 14 safe_raw(xshr, xraw); 15 } 16