1 // Make sure that creating a raw ptr next to a shared ref works 2 // but the shared ref still gets invalidated when the raw ptr is used for writing. 3 main()4fn main() { unsafe { 5 use std::mem; 6 let x = &mut 0; 7 let y1: &i32 = mem::transmute(&*x); // launder lifetimes 8 let y2 = x as *mut _; 9 let _val = *y2; 10 let _val = *y1; 11 *y2 += 1; 12 let _fail = *y1; //~ ERROR borrow stack 13 } } 14