blob: 81b8a336a2048c633e0d07b058139997f194195c (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
error[E0382]: use of moved value: `x`
--> $DIR/binop-move-semantics.rs:18:5
|
LL | x
| - value moved here
LL | +
LL | x; //~ ERROR: use of moved value
| ^ value used here after move
|
= note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
error[E0382]: use of moved value: `x`
--> $DIR/binop-move-semantics.rs:24:5
|
LL | x
| - value moved here
LL | +
LL | x.clone(); //~ ERROR: use of moved value
| ^ value used here after move
|
= note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
error[E0505]: cannot move out of `x` because it is borrowed
--> $DIR/binop-move-semantics.rs:31:5
|
LL | let m = &x;
| - borrow of `x` occurs here
...
LL | x //~ ERROR: cannot move out of `x` because it is borrowed
| ^ move out of `x` occurs here
error[E0505]: cannot move out of `y` because it is borrowed
--> $DIR/binop-move-semantics.rs:33:5
|
LL | let n = &mut y;
| - borrow of `y` occurs here
...
LL | y; //~ ERROR: cannot move out of `y` because it is borrowed
| ^ move out of `y` occurs here
error[E0507]: cannot move out of borrowed content
--> $DIR/binop-move-semantics.rs:40:5
|
LL | *m //~ ERROR: cannot move out of borrowed content
| ^^ cannot move out of borrowed content
error[E0507]: cannot move out of borrowed content
--> $DIR/binop-move-semantics.rs:42:5
|
LL | *n; //~ ERROR: cannot move out of borrowed content
| ^^ cannot move out of borrowed content
error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
--> $DIR/binop-move-semantics.rs:64:6
|
LL | &mut f
| - mutable borrow occurs here
LL | +
LL | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
| ^
| |
| immutable borrow occurs here
| mutable borrow ends here
error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
--> $DIR/binop-move-semantics.rs:72:10
|
LL | &f
| - immutable borrow occurs here
LL | +
LL | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
| ^
| |
| mutable borrow occurs here
| immutable borrow ends here
error: aborting due to 8 previous errors
Some errors occurred: E0382, E0502, E0505, E0507.
For more information about an error, try `rustc --explain E0382`.
|