fork/rust

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

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

1.44.0
3.0 KiB101 linesraw
1error[E0382]: use of moved value: `x`
2  --> $DIR/binop-move-semantics.rs:8:5
3   |
4LL | fn double_move<T: Add<Output=()>>(x: T) {
5   |                                   - move occurs because `x` has type `T`, which does not implement the `Copy` trait
6LL |     x
7   |     - value moved here
8LL |     +
9LL |     x;
10   |     ^ value used here after move
11   |
12help: consider further restricting this bound
13   |
14LL | fn double_move<T: Add<Output=()> + Copy>(x: T) {
15   |                                  ^^^^^^
16
17error[E0382]: borrow of moved value: `x`
18  --> $DIR/binop-move-semantics.rs:14:5
19   |
20LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
21   |                                                - move occurs because `x` has type `T`, which does not implement the `Copy` trait
22LL |     x
23   |     - value moved here
24LL |     +
25LL |     x.clone();
26   |     ^ value borrowed here after move
27   |
28help: consider further restricting this bound
29   |
30LL | fn move_then_borrow<T: Add<Output=()> + Clone + Copy>(x: T) {
31   |                                               ^^^^^^
32
33error[E0505]: cannot move out of `x` because it is borrowed
34  --> $DIR/binop-move-semantics.rs:21:5
35   |
36LL |     let m = &x;
37   |             -- borrow of `x` occurs here
38...
39LL |     x
40   |     ^ move out of `x` occurs here
41...
42LL |     use_mut(n); use_imm(m);
43   |                         - borrow later used here
44
45error[E0505]: cannot move out of `y` because it is borrowed
46  --> $DIR/binop-move-semantics.rs:23:5
47   |
48LL |     let n = &mut y;
49   |             ------ borrow of `y` occurs here
50...
51LL |     y;
52   |     ^ move out of `y` occurs here
53LL |     use_mut(n); use_imm(m);
54   |             - borrow later used here
55
56error[E0507]: cannot move out of `*m` which is behind a mutable reference
57  --> $DIR/binop-move-semantics.rs:30:5
58   |
59LL |     *m
60   |     ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait
61
62error[E0507]: cannot move out of `*n` which is behind a shared reference
63  --> $DIR/binop-move-semantics.rs:32:5
64   |
65LL |     *n;
66   |     ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait
67
68error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
69  --> $DIR/binop-move-semantics.rs:54:5
70   |
71LL |       &mut f
72   |       ------
73   |       |
74   |  _____mutable borrow occurs here
75   | |
76LL | |     +
77LL | |     &f;
78   | |     ^-
79   | |_____||
80   |       |mutable borrow later used here
81   |       immutable borrow occurs here
82
83error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
84  --> $DIR/binop-move-semantics.rs:62:5
85   |
86LL |       &f
87   |       --
88   |       |
89   |  _____immutable borrow occurs here
90   | |
91LL | |     +
92LL | |     &mut f;
93   | |     ^^^^^-
94   | |_____|____|
95   |       |    immutable borrow later used here
96   |       mutable borrow occurs here
97
98error: aborting due to 8 previous errors
99
100Some errors have detailed explanations: E0382, E0502, E0505, E0507.
101For more information about an error, try `rustc --explain E0382`.