]>
Commit | Line | Data |
---|---|---|
48663c56 | 1 | error[E0382]: borrow of moved value: `x` |
0731742a | 2 | --> $DIR/unop-move-semantics.rs:8:5 |
b7449926 | 3 | | |
48663c56 | 4 | LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) { |
74b04a01 | 5 | | - move occurs because `x` has type `T`, which does not implement the `Copy` trait |
b7449926 | 6 | LL | !x; |
f035d41b | 7 | | -- `x` moved due to usage in operator |
b7449926 | 8 | LL | |
532ac7d7 | 9 | LL | x.clone(); |
48663c56 | 10 | | ^ value borrowed here after move |
74b04a01 | 11 | | |
f035d41b | 12 | note: calling this operator moves the left-hand side |
3dfed10e | 13 | --> $SRC_DIR/core/src/ops/bit.rs:LL:COL |
f035d41b XL |
14 | | |
15 | LL | fn not(self) -> Self::Output; | |
16 | | ^^^^ | |
ba9703b0 | 17 | help: consider further restricting this bound |
74b04a01 | 18 | | |
ba9703b0 | 19 | LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) { |
94222f64 | 20 | | ++++++ |
b7449926 XL |
21 | |
22 | error[E0505]: cannot move out of `x` because it is borrowed | |
0731742a | 23 | --> $DIR/unop-move-semantics.rs:15:6 |
b7449926 XL |
24 | | |
25 | LL | let m = &x; | |
48663c56 | 26 | | -- borrow of `x` occurs here |
b7449926 | 27 | ... |
532ac7d7 | 28 | LL | !x; |
b7449926 | 29 | | ^ move out of `x` occurs here |
48663c56 XL |
30 | ... |
31 | LL | use_mut(n); use_imm(m); | |
32 | | - borrow later used here | |
b7449926 XL |
33 | |
34 | error[E0505]: cannot move out of `y` because it is borrowed | |
0731742a | 35 | --> $DIR/unop-move-semantics.rs:17:6 |
b7449926 XL |
36 | | |
37 | LL | let n = &mut y; | |
48663c56 | 38 | | ------ borrow of `y` occurs here |
b7449926 | 39 | ... |
532ac7d7 | 40 | LL | !y; |
b7449926 | 41 | | ^ move out of `y` occurs here |
48663c56 XL |
42 | LL | use_mut(n); use_imm(m); |
43 | | - borrow later used here | |
b7449926 | 44 | |
dc9dc135 | 45 | error[E0507]: cannot move out of `*m` which is behind a mutable reference |
0731742a | 46 | --> $DIR/unop-move-semantics.rs:24:6 |
b7449926 | 47 | | |
532ac7d7 | 48 | LL | !*m; |
dc9dc135 | 49 | | ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait |
b7449926 | 50 | |
dc9dc135 | 51 | error[E0507]: cannot move out of `*n` which is behind a shared reference |
0731742a | 52 | --> $DIR/unop-move-semantics.rs:26:6 |
b7449926 | 53 | | |
532ac7d7 | 54 | LL | !*n; |
dc9dc135 | 55 | | ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait |
b7449926 XL |
56 | |
57 | error: aborting due to 5 previous errors | |
58 | ||
48663c56 | 59 | Some errors have detailed explanations: E0382, E0505, E0507. |
b7449926 | 60 | For more information about an error, try `rustc --explain E0382`. |