1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:26:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:33:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:36:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:44:9
|
LL | let ref mut a @ (
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | ref mut b,
| --------- value is mutably borrowed by `b` here
LL | [
LL | ref mut c,
| --------- value is mutably borrowed by `c` here
LL | ref mut d,
| --------- value is mutably borrowed by `d` here
LL | ref e,
| ----- value is borrowed by `e` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:54:9
|
LL | let ref mut a @ (
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | ref mut b,
| --------- value is mutably borrowed by `b` here
LL | [
LL | ref mut c,
| --------- value is mutably borrowed by `c` here
LL | ref mut d,
| --------- value is mutably borrowed by `d` here
LL | ref e,
| ----- value is borrowed by `e` here
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:64:9
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
| ^ --------- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ (ref mut b, ref mut c) = (U, U);
| +++
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
| ^ - - - value borrowed here after move
| | | |
| | | value borrowed here after move
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `&mut (U, [U; 2])` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ (b, [c, d]) = &mut val; // Same as ^--
| +++
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
|
LL | let a @ &mut ref mut b = &mut U;
| ^ --------- value borrowed here after move
| |
| value moved into `a` here
| move occurs because `a` has type `&mut U` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ &mut ref mut b = &mut U;
| +++
error: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:72:9
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| ^ --------- --------- value borrowed here after move
| | |
| | value borrowed here after move
| value moved into `a` here
| move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait
|
help: borrow this binding in the pattern to avoid moving the value
|
LL | let ref a @ &mut (ref mut b, ref mut c) = &mut (U, U);
| +++
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:9
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:37
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- first mutable borrow occurs here
| |
| second mutable borrow occurs here
...
LL | drop(b);
| - first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
LL | let ref mut a @ ref mut b = U;
| ^^^^^^^^^ --------- first mutable borrow occurs here
| |
| second mutable borrow occurs here
...
LL | *b = U;
| ------ first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
| first mutable borrow occurs here
...
LL | *a = Err(U);
| ----------- first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:89:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
| first mutable borrow occurs here
...
LL | *a = Err(U);
| ----------- first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:24
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
| first mutable borrow occurs here
...
LL | drop(a);
| - first borrow later used here
error[E0499]: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:53
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
| --------- ^^^^^^^^^ second mutable borrow occurs here
| |
| first mutable borrow occurs here
...
LL | drop(a);
| - first borrow later used here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:8:11
|
LL | fn f1(ref mut a @ ref mut b: U) {}
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
LL | fn f2(ref mut a @ ref mut b: U) {}
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
| |
| value is mutably borrowed by `a` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:13:9
|
LL | ref mut a @ [
| ^^^^^^^^^ value is mutably borrowed by `a` here
LL |
LL | [ref b @ .., _],
| ----- value is borrowed by `b` here
LL | [_, ref mut mid @ ..],
| ----------- value is mutably borrowed by `mid` here
error: cannot borrow value as mutable more than once at a time
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:22
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ^^^^^^^^^ --------- - value is moved into `c` here
| | |
| | value is mutably borrowed by `b` here
| value is mutably borrowed by `a` here
error: cannot move out of value because it is borrowed
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| ^^^^^^^^^ - value is moved into `c` here
| |
| value is mutably borrowed by `b` here
error[E0382]: borrow of moved value
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
| --------- ^^^^^^^^^ - value moved here
| | |
| | value borrowed here after move
| move occurs because value has type `U`, which does not implement the `Copy` trait
error: aborting due to 31 previous errors
Some errors have detailed explanations: E0382, E0499.
For more information about an error, try `rustc --explain E0382`.
|