Skip to content

Commit 66202c1

Browse files
committed
Add nll test
1 parent ae883dc commit 66202c1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
error[E0505]: cannot move out of `a` because it is borrowed
2+
--> $DIR/borrow-for-loop-head.rs:4:18
3+
|
4+
LL | for i in &a {
5+
| --
6+
| |
7+
| borrow of `a` occurs here
8+
| borrow later used here
9+
LL | for j in a {
10+
| ^ move out of `a` occurs here
11+
12+
error[E0382]: use of moved value: `a`
13+
--> $DIR/borrow-for-loop-head.rs:4:18
14+
|
15+
LL | let a = vec![1, 2, 3];
16+
| - move occurs because `a` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
17+
LL | for i in &a {
18+
LL | for j in a {
19+
| ^ value moved here, in previous iteration of loop
20+
21+
error: aborting due to 2 previous errors
22+
23+
Some errors occurred: E0382, E0505.
24+
For more information about an error, try `rustc --explain E0382`.

0 commit comments

Comments
 (0)