2019-03-14 18:09:47 -05:00
|
|
|
error[E0505]: cannot move out of `a` because it is borrowed
|
|
|
|
--> $DIR/borrow-for-loop-head.rs:4:18
|
|
|
|
|
|
|
|
|
LL | for i in &a {
|
2019-04-22 02:40:08 -05:00
|
|
|
| -- borrow of `a` occurs here
|
2019-03-14 18:09:47 -05:00
|
|
|
LL | for j in a {
|
|
|
|
| ^ move out of `a` occurs here
|
|
|
|
|
|
|
|
error[E0382]: use of moved value: `a`
|
|
|
|
--> $DIR/borrow-for-loop-head.rs:4:18
|
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | let a = vec![1, 2, 3];
|
2020-09-02 02:40:56 -05:00
|
|
|
| - move occurs because `a` has type `Vec<i32>`, which does not implement the `Copy` trait
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | for i in &a {
|
2019-03-14 18:09:47 -05:00
|
|
|
LL | for j in a {
|
2019-05-24 20:23:43 -05:00
|
|
|
| ^
|
|
|
|
| |
|
|
|
|
| value moved here, in previous iteration of loop
|
|
|
|
| help: consider borrowing to avoid moving into the for loop: `&a`
|
2019-03-14 18:09:47 -05:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
Some errors have detailed explanations: E0382, E0505.
|
2019-03-14 18:09:47 -05:00
|
|
|
For more information about an error, try `rustc --explain E0382`.
|