]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / 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:17:9
3    |
4 LL |     for &x in &vector {
5    |                ------
6    |                |    |
7    |                |    immutable borrow ends here
8    |                immutable borrow occurs here
9 LL |         let cap = vector.capacity();
10 LL |         vector.extend(repeat(0));      //~ ERROR cannot borrow
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:18:9
15    |
16 LL |     for &x in &vector {
17    |                ------
18    |                |    |
19    |                |    immutable borrow ends here
20    |                immutable borrow occurs here
21 ...
22 LL |         vector[1] = 5;   //~ ERROR cannot borrow
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`.