fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.5 KiB75 linesraw
1error[E0382]: borrow of moved value: `x`
2  --> $DIR/unop-move-semantics.rs:8:5
3   |
4LL | 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
6LL |     !x;
7   |     -- `x` moved due to usage in operator
8LL |
9LL |     x.clone();
10   |     ^ value borrowed here after move
11   |
12note: calling this operator moves the left-hand side
13  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
14help: consider cloning the value if the performance cost is acceptable
15   |
16LL |     !x.clone();
17   |       ++++++++
18help: consider further restricting this bound
19   |
20LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) {
21   |                                              ++++++
22
23error[E0505]: cannot move out of `x` because it is borrowed
24  --> $DIR/unop-move-semantics.rs:15:6
25   |
26LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
27   |                                    - binding `x` declared here
28LL |     let m = &x;
29   |             -- borrow of `x` occurs here
30...
31LL |     !x;
32   |      ^ move out of `x` occurs here
33...
34LL |     use_mut(n); use_imm(m);
35   |                         - borrow later used here
36
37error[E0505]: cannot move out of `y` because it is borrowed
38  --> $DIR/unop-move-semantics.rs:17:6
39   |
40LL | fn move_borrowed<T: Not<Output=T>>(x: T, mut y: T) {
41   |                                          ----- binding `y` declared here
42LL |     let m = &x;
43LL |     let n = &mut y;
44   |             ------ borrow of `y` occurs here
45...
46LL |     !y;
47   |      ^ move out of `y` occurs here
48LL |     use_mut(n); use_imm(m);
49   |             - borrow later used here
50
51error[E0507]: cannot move out of `*m` which is behind a mutable reference
52  --> $DIR/unop-move-semantics.rs:24:6
53   |
54LL |     !*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   |
60note: calling this operator moves the left-hand side
61  --> $SRC_DIR/core/src/ops/bit.rs:LL:COL
62
63error[E0507]: cannot move out of `*n` which is behind a shared reference
64  --> $DIR/unop-move-semantics.rs:26:6
65   |
66LL |     !*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
72error: aborting due to 5 previous errors
73
74Some errors have detailed explanations: E0382, E0505, E0507.
75For more information about an error, try `rustc --explain E0382`.