| // Tests that two closures cannot simultaneously have mutable |
| // and immutable access to the variable. Issue #6801. |
| fn get(x: &isize) -> isize { |
| //~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable |
| //~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable |
| //~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable |
| //~^ ERROR cannot assign to `x` because it is borrowed |
| //~^ ERROR cannot assign to `x` because it is borrowed |
| let mut x: Box<_> = Box::new(3); |
| //~^ ERROR cannot assign to `*x` because it is borrowed |
| let mut x: Box<_> = Box::new(Foo { f: Box::new(3) }); |
| //~^ ERROR cannot assign to `*x.f` because it is borrowed |
| let mut x: Box<_> = Box::new(Foo { f: Box::new(3) }); |
| //~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable |