fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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