blob: 0446ef7b0665740621e50ba4e4799d7403e86bf9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
error[E0382]: use of moved value: `x`
--> $DIR/closure-move-spans.rs:5:13
|
LL | fn move_after_move(x: String) {
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL | || x;
| -- - variable moved due to use in closure
| |
| value moved into closure here
LL | let y = x;
| ^ value used here after move
error[E0382]: borrow of moved value: `x`
--> $DIR/closure-move-spans.rs:10:13
|
LL | fn borrow_after_move(x: String) {
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL | || x;
| -- - variable moved due to use in closure
| |
| value moved into closure here
LL | let y = &x;
| ^^ value borrowed here after move
error[E0382]: borrow of moved value: `x`
--> $DIR/closure-move-spans.rs:15:13
|
LL | fn borrow_mut_after_move(mut x: String) {
| ----- move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL | || x;
| -- - variable moved due to use in closure
| |
| value moved into closure here
LL | let y = &mut x;
| ^^^^^^ value borrowed here after move
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0382`.
|