]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | error[E0382]: use of moved value: `x` |
0731742a | 2 | --> $DIR/binop-move-semantics.rs:8:5 |
b7449926 | 3 | | |
48663c56 | 4 | LL | fn double_move<T: Add<Output=()>>(x: T) { |
74b04a01 | 5 | | - move occurs because `x` has type `T`, which does not implement the `Copy` trait |
b7449926 XL |
6 | LL | x |
7 | | - value moved here | |
8 | LL | + | |
532ac7d7 | 9 | LL | x; |
b7449926 | 10 | | ^ value used here after move |
74b04a01 | 11 | | |
ba9703b0 | 12 | help: consider further restricting this bound |
74b04a01 | 13 | | |
ba9703b0 XL |
14 | LL | fn double_move<T: Add<Output=()> + Copy>(x: T) { |
15 | | ^^^^^^ | |
b7449926 | 16 | |
48663c56 | 17 | error[E0382]: borrow of moved value: `x` |
0731742a | 18 | --> $DIR/binop-move-semantics.rs:14:5 |
b7449926 | 19 | | |
48663c56 | 20 | LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) { |
74b04a01 | 21 | | - move occurs because `x` has type `T`, which does not implement the `Copy` trait |
b7449926 XL |
22 | LL | x |
23 | | - value moved here | |
24 | LL | + | |
532ac7d7 | 25 | LL | x.clone(); |
48663c56 | 26 | | ^ value borrowed here after move |
74b04a01 | 27 | | |
ba9703b0 | 28 | help: consider further restricting this bound |
74b04a01 | 29 | | |
ba9703b0 XL |
30 | LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) { |
31 | | ^^^^^^ | |
b7449926 XL |
32 | |
33 | error[E0505]: cannot move out of `x` because it is borrowed | |
0731742a | 34 | --> $DIR/binop-move-semantics.rs:21:5 |
b7449926 XL |
35 | | |
36 | LL | let m = &x; | |
48663c56 | 37 | | -- borrow of `x` occurs here |
b7449926 | 38 | ... |
532ac7d7 | 39 | LL | x |
b7449926 | 40 | | ^ move out of `x` occurs here |
48663c56 XL |
41 | ... |
42 | LL | use_mut(n); use_imm(m); | |
43 | | - borrow later used here | |
b7449926 XL |
44 | |
45 | error[E0505]: cannot move out of `y` because it is borrowed | |
0731742a | 46 | --> $DIR/binop-move-semantics.rs:23:5 |
b7449926 XL |
47 | | |
48 | LL | let n = &mut y; | |
48663c56 | 49 | | ------ borrow of `y` occurs here |
b7449926 | 50 | ... |
532ac7d7 | 51 | LL | y; |
b7449926 | 52 | | ^ move out of `y` occurs here |
48663c56 XL |
53 | LL | use_mut(n); use_imm(m); |
54 | | - borrow later used here | |
b7449926 | 55 | |
dc9dc135 | 56 | error[E0507]: cannot move out of `*m` which is behind a mutable reference |
0731742a | 57 | --> $DIR/binop-move-semantics.rs:30:5 |
b7449926 | 58 | | |
532ac7d7 | 59 | LL | *m |
dc9dc135 | 60 | | ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait |
b7449926 | 61 | |
dc9dc135 | 62 | error[E0507]: cannot move out of `*n` which is behind a shared reference |
0731742a | 63 | --> $DIR/binop-move-semantics.rs:32:5 |
b7449926 | 64 | | |
532ac7d7 | 65 | LL | *n; |
dc9dc135 | 66 | | ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait |
b7449926 XL |
67 | |
68 | error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable | |
48663c56 | 69 | --> $DIR/binop-move-semantics.rs:54:5 |
b7449926 | 70 | | |
48663c56 XL |
71 | LL | &mut f |
72 | | ------ | |
73 | | | | |
74 | | _____mutable borrow occurs here | |
75 | | | | |
76 | LL | | + | |
77 | LL | | &f; | |
78 | | | ^- | |
79 | | |_____|| | |
80 | | |mutable borrow later used here | |
81 | | immutable borrow occurs here | |
b7449926 XL |
82 | |
83 | error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable | |
48663c56 | 84 | --> $DIR/binop-move-semantics.rs:62:5 |
b7449926 | 85 | | |
48663c56 XL |
86 | LL | &f |
87 | | -- | |
88 | | | | |
89 | | _____immutable borrow occurs here | |
90 | | | | |
91 | LL | | + | |
92 | LL | | &mut f; | |
93 | | | ^^^^^- | |
94 | | |_____|____| | |
95 | | | immutable borrow later used here | |
96 | | mutable borrow occurs here | |
b7449926 XL |
97 | |
98 | error: aborting due to 8 previous errors | |
99 | ||
48663c56 | 100 | Some errors have detailed explanations: E0382, E0502, E0505, E0507. |
b7449926 | 101 | For more information about an error, try `rustc --explain E0382`. |