fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

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