fork/rust

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

borsAuto merge of #71868 - Mark-Simulacrum:stable-1.43.1, r=pietroalbini8d69840ab92

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