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