1 // We want to test that granting a SharedReadWrite will be added 2 // *below* an already granted Unique -- so writing to 3 // the SharedReadWrite will invalidate the Unique. 4 5 use std::mem; 6 use std::cell::Cell; 7 main()8fn main() { unsafe { 9 let x = &mut Cell::new(0); 10 let y: &mut Cell<i32> = mem::transmute(&mut *x); // launder lifetime 11 let shr_rw = &*x; // thanks to interior mutability this will be a SharedReadWrite 12 shr_rw.set(1); 13 y.get_mut(); //~ ERROR borrow stack 14 } } 15