blob: fd00138356d251d25cdba435dd82b8fa930866a0 [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 ends here
| immutable borrow occurs here
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 ends here
| immutable borrow occurs here
...
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`.