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