fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.8 KiB56 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   |      - value moved here
8LL | 
9LL |     x.clone();
10   |     ^ value borrowed here after move
11   |
12help: consider further restricting this bound with `+ Copy`
13  --> $DIR/unop-move-semantics.rs:5:24
14   |
15LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) {
16   |                        ^^^^^^^^^^^^^^^^^^^^^
17
18error[E0505]: cannot move out of `x` because it is borrowed
19  --> $DIR/unop-move-semantics.rs:15:6
20   |
21LL |     let m = &x;
22   |             -- borrow of `x` occurs here
23...
24LL |     !x;
25   |      ^ move out of `x` occurs here
26...
27LL |     use_mut(n); use_imm(m);
28   |                         - borrow later used here
29
30error[E0505]: cannot move out of `y` because it is borrowed
31  --> $DIR/unop-move-semantics.rs:17:6
32   |
33LL |     let n = &mut y;
34   |             ------ borrow of `y` occurs here
35...
36LL |     !y;
37   |      ^ move out of `y` occurs here
38LL |     use_mut(n); use_imm(m);
39   |             - borrow later used here
40
41error[E0507]: cannot move out of `*m` which is behind a mutable reference
42  --> $DIR/unop-move-semantics.rs:24:6
43   |
44LL |     !*m;
45   |      ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait
46
47error[E0507]: cannot move out of `*n` which is behind a shared reference
48  --> $DIR/unop-move-semantics.rs:26:6
49   |
50LL |     !*n;
51   |      ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait
52
53error: aborting due to 5 previous errors
54
55Some errors have detailed explanations: E0382, E0505, E0507.
56For more information about an error, try `rustc --explain E0382`.