@@ -7,6 +7,11 @@ LL | let _y = Foo { f:x };
7
7
| - value moved here
8
8
LL | touch(&x);
9
9
| ^^ value borrowed here after move
10
+ |
11
+ help: consider cloning `x`
12
+ |
13
+ LL | let _y = Foo { f:x.clone() };
14
+ | ++++++++
10
15
11
16
error[E0382]: borrow of moved value: `x`
12
17
--> $DIR/moves-based-on-type-exprs.rs:18:11
@@ -17,6 +22,11 @@ LL | let _y = (x, 3);
17
22
| - value moved here
18
23
LL | touch(&x);
19
24
| ^^ value borrowed here after move
25
+ |
26
+ help: consider cloning `x`
27
+ |
28
+ LL | let _y = (x.clone(), 3);
29
+ | ++++++++
20
30
21
31
error[E0382]: borrow of moved value: `x`
22
32
--> $DIR/moves-based-on-type-exprs.rs:35:11
@@ -29,6 +39,11 @@ LL | x
29
39
...
30
40
LL | touch(&x);
31
41
| ^^ value borrowed here after move
42
+ |
43
+ help: consider cloning `x`
44
+ |
45
+ LL | x.clone()
46
+ | ++++++++
32
47
33
48
error[E0382]: borrow of moved value: `y`
34
49
--> $DIR/moves-based-on-type-exprs.rs:36:11
@@ -41,6 +56,11 @@ LL | y
41
56
...
42
57
LL | touch(&y);
43
58
| ^^ value borrowed here after move
59
+ |
60
+ help: consider cloning `y`
61
+ |
62
+ LL | y.clone()
63
+ | ++++++++
44
64
45
65
error[E0382]: borrow of moved value: `x`
46
66
--> $DIR/moves-based-on-type-exprs.rs:46:11
@@ -53,6 +73,11 @@ LL | true => x,
53
73
...
54
74
LL | touch(&x);
55
75
| ^^ value borrowed here after move
76
+ |
77
+ help: consider cloning `x`
78
+ |
79
+ LL | true => x.clone(),
80
+ | ++++++++
56
81
57
82
error[E0382]: borrow of moved value: `y`
58
83
--> $DIR/moves-based-on-type-exprs.rs:47:11
@@ -65,6 +90,11 @@ LL | false => y
65
90
...
66
91
LL | touch(&y);
67
92
| ^^ value borrowed here after move
93
+ |
94
+ help: consider cloning `y`
95
+ |
96
+ LL | false => y.clone()
97
+ | ++++++++
68
98
69
99
error[E0382]: borrow of moved value: `x`
70
100
--> $DIR/moves-based-on-type-exprs.rs:58:11
@@ -77,6 +107,11 @@ LL | _ if guard(x) => 10,
77
107
...
78
108
LL | touch(&x);
79
109
| ^^ value borrowed here after move
110
+ |
111
+ help: consider cloning `x`
112
+ |
113
+ LL | _ if guard(x.clone()) => 10,
114
+ | ++++++++
80
115
81
116
error[E0382]: borrow of moved value: `x`
82
117
--> $DIR/moves-based-on-type-exprs.rs:65:11
@@ -87,6 +122,11 @@ LL | let _y = [x];
87
122
| - value moved here
88
123
LL | touch(&x);
89
124
| ^^ value borrowed here after move
125
+ |
126
+ help: consider cloning `x`
127
+ |
128
+ LL | let _y = [x.clone()];
129
+ | ++++++++
90
130
91
131
error[E0382]: borrow of moved value: `x`
92
132
--> $DIR/moves-based-on-type-exprs.rs:71:11
@@ -97,6 +137,11 @@ LL | let _y = vec![x];
97
137
| - value moved here
98
138
LL | touch(&x);
99
139
| ^^ value borrowed here after move
140
+ |
141
+ help: consider cloning `x`
142
+ |
143
+ LL | let _y = vec![x.clone()];
144
+ | ++++++++
100
145
101
146
error[E0382]: borrow of moved value: `x`
102
147
--> $DIR/moves-based-on-type-exprs.rs:77:11
@@ -113,6 +158,10 @@ note: this function takes ownership of the receiver `self`, which moves `x`
113
158
|
114
159
LL | fn into_iter(self) -> Self::IntoIter;
115
160
| ^^^^
161
+ help: consider cloning `x`
162
+ |
163
+ LL | let _y = x.clone().into_iter().next().unwrap();
164
+ | ++++++++
116
165
117
166
error[E0382]: borrow of moved value: `x`
118
167
--> $DIR/moves-based-on-type-exprs.rs:83:11
@@ -129,6 +178,10 @@ note: this function takes ownership of the receiver `self`, which moves `x`
129
178
|
130
179
LL | fn into_iter(self) -> Self::IntoIter;
131
180
| ^^^^
181
+ help: consider cloning `x`
182
+ |
183
+ LL | let _y = [x.clone().into_iter().next().unwrap(); 1];
184
+ | ++++++++
132
185
133
186
error: aborting due to 11 previous errors
134
187
0 commit comments