]> git.lizzy.rs Git - rust.git/blob - tests/ui/unop-move-semantics.stderr
Rollup merge of #106797 - FawazTirmizi:dev/issues/104284, r=bjorn3
[rust.git] / tests / ui / unop-move-semantics.stderr
1 error[E0382]: borrow of moved value: `x`
2   --> $DIR/unop-move-semantics.rs:8:5
3    |
4 LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
5    |                                               - move occurs because `x` has type `T`, which does not implement the `Copy` trait
6 LL |     !x;
7    |     -- `x` moved due to usage in operator
8 LL |
9 LL |     x.clone();
10    |     ^^^^^^^^^ value borrowed here after move
11    |
12 note: calling this operator moves the left-hand side
13   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
14 help: consider cloning the value if the performance cost is acceptable
15    |
16 LL |     !x.clone();
17    |       ++++++++
18 help: consider further restricting this bound
19    |
20 LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) {
21    |                                              ++++++
22
23 error[E0505]: cannot move out of `x` because it is borrowed
24   --> $DIR/unop-move-semantics.rs:15:6
25    |
26 LL |     let m = &x;
27    |             -- borrow of `x` occurs here
28 ...
29 LL |     !x;
30    |      ^ move out of `x` occurs here
31 ...
32 LL |     use_mut(n); use_imm(m);
33    |                         - borrow later used here
34
35 error[E0505]: cannot move out of `y` because it is borrowed
36   --> $DIR/unop-move-semantics.rs:17:6
37    |
38 LL |     let n = &mut y;
39    |             ------ borrow of `y` occurs here
40 ...
41 LL |     !y;
42    |      ^ move out of `y` occurs here
43 LL |     use_mut(n); use_imm(m);
44    |             - borrow later used here
45
46 error[E0507]: cannot move out of `*m` which is behind a mutable reference
47   --> $DIR/unop-move-semantics.rs:24:6
48    |
49 LL |     !*m;
50    |     -^^
51    |     ||
52    |     |move occurs because `*m` has type `T`, which does not implement the `Copy` trait
53    |     `*m` moved due to usage in operator
54    |
55 note: calling this operator moves the left-hand side
56   --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
57
58 error[E0507]: cannot move out of `*n` which is behind a shared reference
59   --> $DIR/unop-move-semantics.rs:26:6
60    |
61 LL |     !*n;
62    |     -^^
63    |     ||
64    |     |move occurs because `*n` has type `T`, which does not implement the `Copy` trait
65    |     `*n` moved due to usage in operator
66
67 error: aborting due to 5 previous errors
68
69 Some errors have detailed explanations: E0382, E0505, E0507.
70 For more information about an error, try `rustc --explain E0382`.