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