blob: c46e94866ab5a866008731077963d00af8b4864d [file] [log] [blame]
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); //~ ERROR cannot borrow
| ^^^ immutable borrow occurs here
LL | }
LL | *x = box 5;
| -- 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;
| -------- borrow used here in later iteration of loop
LL | borrow(&*v); //~ ERROR cannot borrow
| ^^^ immutable borrow occurs here
LL | if cond2 {
LL | x = &mut v; //~ ERROR cannot borrow
| ------ mutable borrow occurs here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0502`.