]> git.proxmox.com Git - rustc.git/blame - src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-and-ref.stderr
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / pattern / bindings-after-at / borrowck-pat-ref-mut-and-ref.stderr
CommitLineData
74b04a01
XL
1error: cannot borrow value as immutable because it is also borrowed as mutable
2 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:9
dfeec247
XL
3 |
4LL | ref mut z @ &mut Some(ref a) => {
5 | ---------^^^^^^^^^^^^^-----^
6 | | |
74b04a01
XL
7 | | immutable borrow, by `a`, occurs here
8 | mutable borrow, by `z`, occurs here
dfeec247 9
74b04a01
XL
10error: cannot borrow value as mutable more than once at a time
11 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9
dfeec247
XL
12 |
13LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
14 | ---------^^^^-----------------^
15 | | | |
74b04a01
XL
16 | | | another mutable borrow, by `c`, occurs here
17 | | also borrowed as immutable, by `b`, here
18 | first mutable borrow, by `a`, occurs here
dfeec247 19
74b04a01
XL
20error: cannot borrow value as mutable because it is also borrowed as immutable
21 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:22
dfeec247
XL
22 |
23LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
24 | -----^^^---------
25 | | |
74b04a01
XL
26 | | mutable borrow, by `c`, occurs here
27 | immutable borrow, by `b`, occurs here
dfeec247 28
74b04a01
XL
29error: cannot borrow value as mutable because it is also borrowed as immutable
30 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9
dfeec247
XL
31 |
32LL | let ref a @ ref mut b = U;
33 | -----^^^---------
34 | | |
74b04a01
XL
35 | | mutable borrow, by `b`, occurs here
36 | immutable borrow, by `a`, occurs here
dfeec247 37
74b04a01
XL
38error: cannot borrow value as immutable because it is also borrowed as mutable
39 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9
dfeec247
XL
40 |
41LL | let ref mut a @ ref b = U;
42 | ---------^^^-----
43 | | |
74b04a01
XL
44 | | immutable borrow, by `b`, occurs here
45 | mutable borrow, by `a`, occurs here
dfeec247 46
74b04a01
XL
47error: cannot borrow value as mutable because it is also borrowed as immutable
48 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:43:9
dfeec247
XL
49 |
50LL | let ref a @ (ref mut b, ref mut c) = (U, U);
51 | -----^^^^---------^^---------^
52 | | | |
74b04a01
XL
53 | | | mutable borrow, by `c`, occurs here
54 | | mutable borrow, by `b`, occurs here
55 | immutable borrow, by `a`, occurs here
dfeec247 56
74b04a01
XL
57error: cannot borrow value as immutable because it is also borrowed as mutable
58 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:45:9
dfeec247
XL
59 |
60LL | let ref mut a @ (ref b, ref c) = (U, U);
61 | ---------^^^^-----^^-----^
62 | | | |
74b04a01
XL
63 | | | immutable borrow, by `c`, occurs here
64 | | immutable borrow, by `b`, occurs here
65 | mutable borrow, by `a`, occurs here
dfeec247 66
74b04a01
XL
67error: cannot borrow value as immutable because it is also borrowed as mutable
68 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:48:9
dfeec247
XL
69 |
70LL | let ref mut a @ ref b = u();
71 | ---------^^^-----
72 | | |
74b04a01
XL
73 | | immutable borrow, by `b`, occurs here
74 | mutable borrow, by `a`, occurs here
dfeec247 75
74b04a01
XL
76error: cannot borrow value as mutable because it is also borrowed as immutable
77 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:53:9
dfeec247
XL
78 |
79LL | let ref a @ ref mut b = u();
80 | -----^^^---------
81 | | |
74b04a01
XL
82 | | mutable borrow, by `b`, occurs here
83 | immutable borrow, by `a`, occurs here
dfeec247 84
74b04a01
XL
85error: cannot borrow value as immutable because it is also borrowed as mutable
86 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9
dfeec247
XL
87 |
88LL | let ref mut a @ ref b = U;
89 | ---------^^^-----
90 | | |
74b04a01
XL
91 | | immutable borrow, by `b`, occurs here
92 | mutable borrow, by `a`, occurs here
dfeec247 93
74b04a01
XL
94error: cannot borrow value as mutable because it is also borrowed as immutable
95 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:63:9
dfeec247
XL
96 |
97LL | let ref a @ ref mut b = U;
98 | -----^^^---------
99 | | |
74b04a01
XL
100 | | mutable borrow, by `b`, occurs here
101 | immutable borrow, by `a`, occurs here
dfeec247 102
74b04a01
XL
103error: cannot borrow value as immutable because it is also borrowed as mutable
104 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:69:9
dfeec247
XL
105 |
106LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
107 | ---------^^^^^^-----^
108 | | |
74b04a01
XL
109 | | immutable borrow, by `b`, occurs here
110 | mutable borrow, by `a`, occurs here
dfeec247 111
74b04a01
XL
112error: cannot borrow value as immutable because it is also borrowed as mutable
113 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:69:33
dfeec247
XL
114 |
115LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
116 | ---------^^^^^^^-----^
117 | | |
74b04a01
XL
118 | | immutable borrow, by `b`, occurs here
119 | mutable borrow, by `a`, occurs here
dfeec247 120
74b04a01
XL
121error: cannot borrow value as mutable because it is also borrowed as immutable
122 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:9
dfeec247
XL
123 |
124LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
125 | -----^^^^^^---------^
126 | | |
74b04a01
XL
127 | | mutable borrow, by `b`, occurs here
128 | immutable borrow, by `a`, occurs here
dfeec247 129
74b04a01
XL
130error: cannot borrow value as mutable because it is also borrowed as immutable
131 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:33
dfeec247
XL
132 |
133LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
134 | -----^^^^^^^---------^
135 | | |
74b04a01
XL
136 | | mutable borrow, by `b`, occurs here
137 | immutable borrow, by `a`, occurs here
dfeec247 138
74b04a01
XL
139error: cannot borrow value as mutable because it is also borrowed as immutable
140 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:9
dfeec247
XL
141 |
142LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
143 | -----^^^^^^---------^
144 | | |
74b04a01
XL
145 | | mutable borrow, by `b`, occurs here
146 | immutable borrow, by `a`, occurs here
dfeec247 147
74b04a01
XL
148error: cannot borrow value as mutable because it is also borrowed as immutable
149 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:33
dfeec247
XL
150 |
151LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
152 | -----^^^^^^^---------^
153 | | |
74b04a01
XL
154 | | mutable borrow, by `b`, occurs here
155 | immutable borrow, by `a`, occurs here
dfeec247 156
74b04a01
XL
157error: cannot borrow value as immutable because it is also borrowed as mutable
158 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:9
dfeec247
XL
159 |
160LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
161 | ---------^^^^^^-----^
162 | | |
74b04a01
XL
163 | | immutable borrow, by `b`, occurs here
164 | mutable borrow, by `a`, occurs here
dfeec247 165
74b04a01
XL
166error: cannot borrow value as immutable because it is also borrowed as mutable
167 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:33
dfeec247
XL
168 |
169LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
170 | ---------^^^^^^^-----^
171 | | |
74b04a01
XL
172 | | immutable borrow, by `b`, occurs here
173 | mutable borrow, by `a`, occurs here
dfeec247 174
74b04a01
XL
175error: cannot borrow value as mutable because it is also borrowed as immutable
176 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:9
dfeec247
XL
177 |
178LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
179 | -----^^^^^^---------^
180 | | |
74b04a01
XL
181 | | mutable borrow, by `b`, occurs here
182 | immutable borrow, by `a`, occurs here
dfeec247 183
74b04a01
XL
184error: cannot borrow value as mutable because it is also borrowed as immutable
185 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:33
dfeec247
XL
186 |
187LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
188 | -----^^^^^^^---------^
189 | | |
74b04a01
XL
190 | | mutable borrow, by `b`, occurs here
191 | immutable borrow, by `a`, occurs here
dfeec247 192
74b04a01
XL
193error: cannot borrow value as immutable because it is also borrowed as mutable
194 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:9
dfeec247
XL
195 |
196LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
197 | ---------^^^^^^-----^
198 | | |
74b04a01
XL
199 | | immutable borrow, by `b`, occurs here
200 | mutable borrow, by `a`, occurs here
dfeec247 201
74b04a01
XL
202error: cannot borrow value as immutable because it is also borrowed as mutable
203 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:33
dfeec247
XL
204 |
205LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
206 | ---------^^^^^^^-----^
207 | | |
74b04a01
XL
208 | | immutable borrow, by `b`, occurs here
209 | mutable borrow, by `a`, occurs here
dfeec247 210
74b04a01
XL
211error: cannot borrow value as mutable because it is also borrowed as immutable
212 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:119:9
dfeec247
XL
213 |
214LL | let ref a @ (ref mut b, ref mut c) = (U, U);
215 | -----^^^^---------^^---------^
216 | | | |
74b04a01
XL
217 | | | mutable borrow, by `c`, occurs here
218 | | mutable borrow, by `b`, occurs here
219 | immutable borrow, by `a`, occurs here
dfeec247 220
74b04a01
XL
221error: cannot borrow value as mutable because it is also borrowed as immutable
222 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:9
dfeec247
XL
223 |
224LL | let ref a @ (ref mut b, ref mut c) = (U, U);
225 | -----^^^^---------^^---------^
226 | | | |
74b04a01
XL
227 | | | mutable borrow, by `c`, occurs here
228 | | mutable borrow, by `b`, occurs here
229 | immutable borrow, by `a`, occurs here
dfeec247 230
74b04a01
XL
231error: cannot borrow value as mutable because it is also borrowed as immutable
232 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:9
dfeec247
XL
233 |
234LL | let ref a @ (ref mut b, ref mut c) = (U, U);
235 | -----^^^^---------^^---------^
236 | | | |
74b04a01
XL
237 | | | mutable borrow, by `c`, occurs here
238 | | mutable borrow, by `b`, occurs here
239 | immutable borrow, by `a`, occurs here
dfeec247 240
74b04a01
XL
241error: cannot borrow value as immutable because it is also borrowed as mutable
242 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:136:9
dfeec247
XL
243 |
244LL | let ref mut a @ (ref b, ref c) = (U, U);
245 | ---------^^^^-----^^-----^
246 | | | |
74b04a01
XL
247 | | | immutable borrow, by `c`, occurs here
248 | | immutable borrow, by `b`, occurs here
249 | mutable borrow, by `a`, occurs here
dfeec247 250
74b04a01
XL
251error: cannot borrow value as mutable because it is also borrowed as immutable
252 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:25:11
dfeec247
XL
253 |
254LL | fn f1(ref a @ ref mut b: U) {}
255 | -----^^^---------
256 | | |
74b04a01
XL
257 | | mutable borrow, by `b`, occurs here
258 | immutable borrow, by `a`, occurs here
dfeec247 259
74b04a01
XL
260error: cannot borrow value as immutable because it is also borrowed as mutable
261 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:27:11
dfeec247
XL
262 |
263LL | fn f2(ref mut a @ ref b: U) {}
264 | ---------^^^-----
265 | | |
74b04a01
XL
266 | | immutable borrow, by `b`, occurs here
267 | mutable borrow, by `a`, occurs here
dfeec247 268
74b04a01
XL
269error: cannot borrow value as mutable because it is also borrowed as immutable
270 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:29:11
dfeec247
XL
271 |
272LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
273 | -----^^^^^^^^^^^----------------^^^^^^^^
274 | | |
74b04a01
XL
275 | | mutable borrow, by `mid`, occurs here
276 | immutable borrow, by `a`, occurs here
277
278error: cannot borrow value as mutable because it is also borrowed as immutable
279 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:22
280 |
281LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
282 | -----^^^-------------
283 | | | |
284 | | | also moved into `c` here
285 | | mutable borrow, by `b`, occurs here
286 | immutable borrow, by `a`, occurs here
287
288error: cannot move out of value because it is borrowed
289 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:30
290 |
291LL | fn f4_also_moved(ref a @ ref mut b @ c: U) {}
292 | ---------^^^-
293 | | |
294 | | value moved into `c` here
295 | value borrowed, by `b`, here
dfeec247 296
ba9703b0 297error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
74b04a01 298 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:11:31
dfeec247
XL
299 |
300LL | ref mut z @ &mut Some(ref a) => {
301 | ----------------------^^^^^-
302 | | |
303 | | immutable borrow occurs here
304 | mutable borrow occurs here
305...
306LL | **z = None;
307 | ---------- mutable borrow later used here
308
ba9703b0 309error[E0502]: cannot borrow value as immutable because it is also borrowed as mutable
74b04a01 310 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:48:21
dfeec247
XL
311 |
312LL | let ref mut a @ ref b = u();
313 | ------------^^^^^
314 | | |
315 | | immutable borrow occurs here
316 | mutable borrow occurs here
317...
318LL | *a = u();
319 | -------- mutable borrow later used here
320
ba9703b0 321error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 322 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:53:17
dfeec247
XL
323 |
324LL | let ref a @ ref mut b = u();
325 | --------^^^^^^^^^
326 | | |
327 | | mutable borrow occurs here
328 | immutable borrow occurs here
329...
330LL | drop(a);
331 | - immutable borrow later used here
332
ba9703b0 333error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 334 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:20
dfeec247
XL
335 |
336LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
337 | -----------^^^^^^^^^-
338 | | |
339 | | mutable borrow occurs here
340 | immutable borrow occurs here
341...
342LL | drop(a);
343 | - immutable borrow later used here
344
ba9703b0 345error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 346 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:78:45
dfeec247
XL
347 |
348LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
349 | ------------^^^^^^^^^-
350 | | |
351 | | mutable borrow occurs here
352 | immutable borrow occurs here
353...
354LL | drop(a);
355 | - immutable borrow later used here
356
357error[E0594]: cannot assign to `*b`, as it is immutable for the pattern guard
74b04a01 358 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:89:61
dfeec247
XL
359 |
360LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
361 | ^^^^^^ cannot assign
362 |
363 = note: variables bound in patterns are immutable until the end of the pattern guard
364
365error[E0594]: cannot assign to `*a`, as it is immutable for the pattern guard
74b04a01 366 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:96:61
dfeec247
XL
367 |
368LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
369 | ^^^^^^^^^^^ cannot assign
370 |
371 = note: variables bound in patterns are immutable until the end of the pattern guard
372
373error[E0507]: cannot move out of `b` in pattern guard
74b04a01 374 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:66
dfeec247
XL
375 |
376LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
1b1a35ee 377 | ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
dfeec247
XL
378 |
379 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
380
381error[E0507]: cannot move out of `b` in pattern guard
74b04a01 382 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:103:66
dfeec247
XL
383 |
384LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
1b1a35ee 385 | ^ move occurs because `b` has type `&mut U`, which does not implement the `Copy` trait
dfeec247
XL
386 |
387 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
388
389error[E0507]: cannot move out of `a` in pattern guard
74b04a01 390 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:66
dfeec247
XL
391 |
392LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
1b1a35ee 393 | ^ move occurs because `a` has type `&mut std::result::Result<U, U>`, which does not implement the `Copy` trait
dfeec247
XL
394 |
395 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
396
397error[E0507]: cannot move out of `a` in pattern guard
74b04a01 398 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:111:66
dfeec247
XL
399 |
400LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
1b1a35ee 401 | ^ move occurs because `a` has type `&mut std::result::Result<U, U>`, which does not implement the `Copy` trait
dfeec247
XL
402 |
403 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
404
ba9703b0 405error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 406 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:18
dfeec247
XL
407 |
408LL | let ref a @ (ref mut b, ref mut c) = (U, U);
409 | ---------^^^^^^^^^------------
410 | | |
411 | | mutable borrow occurs here
412 | immutable borrow occurs here
413...
414LL | drop(a);
415 | - immutable borrow later used here
416
ba9703b0 417error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 418 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:124:29
dfeec247
XL
419 |
420LL | let ref a @ (ref mut b, ref mut c) = (U, U);
421 | --------------------^^^^^^^^^-
422 | | |
423 | | mutable borrow occurs here
424 | immutable borrow occurs here
425...
426LL | drop(a);
427 | - immutable borrow later used here
428
ba9703b0 429error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 430 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:18
dfeec247
XL
431 |
432LL | let ref a @ (ref mut b, ref mut c) = (U, U);
433 | ---------^^^^^^^^^------------
434 | | |
435 | | mutable borrow occurs here
436 | immutable borrow occurs here
437...
438LL | drop(a);
439 | - immutable borrow later used here
440
ba9703b0 441error[E0502]: cannot borrow value as mutable because it is also borrowed as immutable
74b04a01 442 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:131:29
dfeec247
XL
443 |
444LL | let ref a @ (ref mut b, ref mut c) = (U, U);
445 | --------------------^^^^^^^^^-
446 | | |
447 | | mutable borrow occurs here
448 | immutable borrow occurs here
449...
450LL | drop(a);
451 | - immutable borrow later used here
452
74b04a01 453error: aborting due to 47 previous errors
dfeec247
XL
454
455Some errors have detailed explanations: E0502, E0507, E0594.
456For more information about an error, try `rustc --explain E0502`.