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