]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-for-loop-head-linkage.stderr
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-for-loop-head-linkage.stderr
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
3    |
4 LL |     for &x in &vector {
5    |               -------
6    |               |
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
12
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
15    |
16 LL |     for &x in &vector {
17    |               -------
18    |               |
19    |               immutable borrow occurs here
20    |               immutable borrow later used here
21 ...
22 LL |         vector[1] = 5;
23    |         ^^^^^^ mutable borrow occurs here
24
25 error: aborting due to 2 previous errors
26
27 For more information about this error, try `rustc --explain E0502`.