fork/rust

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

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

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