error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable --> $DIR/borrowck-lend-flow-loop.rs:45:16 | LL | let mut x = &mut v; | ------ mutable borrow occurs here LL | for _ in 0..3 { LL | borrow(&*v); //[ast]~ ERROR cannot borrow | ^^^ immutable borrow occurs here ... LL | *x = box 5; | -- mutable borrow used here, in later iteration of loop error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable --> $DIR/borrowck-lend-flow-loop.rs:109:16 | LL | **x += 1; | -------- mutable borrow used here, in later iteration of loop LL | borrow(&*v); //[ast]~ ERROR cannot borrow | ^^^ immutable borrow occurs here ... LL | x = &mut v; //[ast]~ ERROR cannot borrow | ------ mutable borrow occurs here error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0502`.