blob: a6487ede6f838ba64e5974fc8d1318df7af2f97b [file] [log] [blame]
error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-for-loop-head-linkage.rs:17:9
|
LL | for &x in &vector {
| -------
| |
| immutable borrow occurs here
| immutable borrow used here, in later iteration of loop
LL | let cap = vector.capacity();
LL | vector.extend(repeat(0)); //~ ERROR cannot borrow
| ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
--> $DIR/borrowck-for-loop-head-linkage.rs:18:9
|
LL | for &x in &vector {
| -------
| |
| immutable borrow occurs here
| immutable borrow used here, in later iteration of loop
...
LL | vector[1] = 5; //~ ERROR cannot borrow
| ^^^^^^ mutable borrow occurs here
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0502`.