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