error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable --> $DIR/borrowck-lend-flow-loop.rs:35:17 | LL | let mut x = &mut v; | - mutable borrow occurs here ... LL | borrow(&*v); //[ast]~ ERROR cannot borrow | ^^ immutable borrow occurs here LL | } LL | } | - mutable borrow ends here error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable --> $DIR/borrowck-lend-flow-loop.rs:45:17 | 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 | } | - mutable borrow ends here error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable --> $DIR/borrowck-lend-flow-loop.rs:57:25 | LL | borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow | ^^ mutable borrow occurs here LL | _x = &v; | - immutable borrow occurs here LL | } LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable --> $DIR/borrowck-lend-flow-loop.rs:69:25 | LL | borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow | ^^ mutable borrow occurs here LL | _x = &v; | - immutable borrow occurs here LL | } LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable --> $DIR/borrowck-lend-flow-loop.rs:86:21 | LL | _x = &v; | - immutable borrow occurs here ... LL | borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow | ^^ mutable borrow occurs here LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable --> $DIR/borrowck-lend-flow-loop.rs:100:21 | LL | _x = &v; | - immutable borrow occurs here ... LL | borrow_mut(&mut *v); //[ast]~ ERROR cannot borrow | ^^ mutable borrow occurs here LL | } | - immutable borrow ends here error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable --> $DIR/borrowck-lend-flow-loop.rs:109:17 | LL | borrow(&*v); //[ast]~ ERROR cannot borrow | ^^ immutable borrow occurs here ... LL | x = &mut v; //[ast]~ ERROR cannot borrow | - mutable borrow occurs here ... LL | } | - mutable borrow ends here error[E0499]: cannot borrow `v` as mutable more than once at a time --> $DIR/borrowck-lend-flow-loop.rs:112:22 | LL | x = &mut v; //[ast]~ ERROR cannot borrow | ^ mutable borrow starts here in previous iteration of loop ... LL | } | - mutable borrow ends here error: aborting due to 8 previous errors Some errors occurred: E0499, E0502. For more information about an error, try `rustc --explain E0499`.