fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
898 B24 linesraw
1error[E0505]: cannot move out of `a` because it is borrowed
2  --> $DIR/borrow-for-loop-head.rs:4:18
3   |
4LL |     for i in &a {
5   |              -- borrow of `a` occurs here
6LL |         for j in a {
7   |                  ^ move out of `a` occurs here
8
9error[E0382]: use of moved value: `a`
10  --> $DIR/borrow-for-loop-head.rs:4:18
11   |
12LL |     let a = vec![1, 2, 3];
13   |         - move occurs because `a` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
14LL |     for i in &a {
15LL |         for j in a {
16   |                  ^
17   |                  |
18   |                  value moved here, in previous iteration of loop
19   |                  help: consider borrowing to avoid moving into the for loop: `&a`
20
21error: aborting due to 2 previous errors
22
23Some errors have detailed explanations: E0382, E0505.
24For more information about an error, try `rustc --explain E0382`.