1 // Test that assignments to an `&mut` pointer which is found in a
2 // borrowed (but otherwise non-aliasable) location is illegal.
8 fn copy_borrowed_ptr<'a>(p: &'a mut S<'a>) -> S<'a> {
9 S { pointer: &mut *p.pointer }
16 let mut y = S { pointer: &mut x };
17 let z = copy_borrowed_ptr(&mut y);
19 //~^ ERROR cannot use `*y.pointer`
20 //~| ERROR cannot assign to `*y.pointer`