1 error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-for-loop-head-linkage.rs:7:9
4 LL | for &x in &vector {
7 | immutable borrow occurs here
8 | immutable borrow later used here
9 LL | let cap = vector.capacity();
10 LL | vector.extend(repeat(0));
11 | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
13 error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
14 --> $DIR/borrowck-for-loop-head-linkage.rs:8:9
16 LL | for &x in &vector {
19 | immutable borrow occurs here
20 | immutable borrow later used here
23 | ^^^^^^ mutable borrow occurs here
25 error: aborting due to 2 previous errors
27 For more information about this error, try `rustc --explain E0502`.