1 error: cannot borrow `z` as immutable because it is also borrowed as mutable
2 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:9
4 LL | ref mut z @ &mut Some(ref a) => {
5 | ---------^^^^^^^^^^^^^-----^
7 | | immutable borrow occurs here
8 | mutable borrow occurs here
10 error: cannot borrow `a` as mutable more than once at a time
11 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:9
13 LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
14 | ---------^^^^-----------------^
16 | | | another mutable borrow occurs here
17 | | also borrowed as immutable here
18 | first mutable borrow occurs here
20 error: cannot borrow `b` as mutable because it is also borrowed as immutable
21 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:22
23 LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub
26 | | mutable borrow occurs here
27 | immutable borrow occurs here
29 error: cannot borrow `a` as mutable because it is also borrowed as immutable
30 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9
32 LL | let ref a @ ref mut b = U;
35 | | mutable borrow occurs here
36 | immutable borrow occurs here
38 error: cannot borrow `a` as immutable because it is also borrowed as mutable
39 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9
41 LL | let ref mut a @ ref b = U;
44 | | immutable borrow occurs here
45 | mutable borrow occurs here
47 error: cannot borrow `a` as mutable because it is also borrowed as immutable
48 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9
50 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
51 | -----^^^^---------^^---------^
53 | | | mutable borrow occurs here
54 | | mutable borrow occurs here
55 | immutable borrow occurs here
57 error: cannot borrow `a` as immutable because it is also borrowed as mutable
58 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9
60 LL | let ref mut a @ (ref b, ref c) = (U, U);
61 | ---------^^^^-----^^-----^
63 | | | immutable borrow occurs here
64 | | immutable borrow occurs here
65 | mutable borrow occurs here
67 error: cannot borrow `a` as immutable because it is also borrowed as mutable
68 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:9
70 LL | let ref mut a @ ref b = u();
73 | | immutable borrow occurs here
74 | mutable borrow occurs here
76 error: cannot borrow `a` as mutable because it is also borrowed as immutable
77 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:9
79 LL | let ref a @ ref mut b = u();
82 | | mutable borrow occurs here
83 | immutable borrow occurs here
85 error: cannot borrow `a` as immutable because it is also borrowed as mutable
86 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:55:9
88 LL | let ref mut a @ ref b = U;
91 | | immutable borrow occurs here
92 | mutable borrow occurs here
94 error: cannot borrow `a` as mutable because it is also borrowed as immutable
95 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9
97 LL | let ref a @ ref mut b = U;
100 | | mutable borrow occurs here
101 | immutable borrow occurs here
103 error: cannot borrow `a` as immutable because it is also borrowed as mutable
104 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:65:9
106 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
107 | ---------^^^^^^-----^
109 | | immutable borrow occurs here
110 | mutable borrow occurs here
112 error: cannot borrow `a` as immutable because it is also borrowed as mutable
113 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:65:33
115 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => {
116 | ---------^^^^^^^-----^
118 | | immutable borrow occurs here
119 | mutable borrow occurs here
121 error: cannot borrow `a` as mutable because it is also borrowed as immutable
122 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:9
124 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
125 | -----^^^^^^---------^
127 | | mutable borrow occurs here
128 | immutable borrow occurs here
130 error: cannot borrow `a` as mutable because it is also borrowed as immutable
131 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:33
133 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
134 | -----^^^^^^^---------^
136 | | mutable borrow occurs here
137 | immutable borrow occurs here
139 error: cannot borrow `a` as mutable because it is also borrowed as immutable
140 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:9
142 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
143 | -----^^^^^^---------^
145 | | mutable borrow occurs here
146 | immutable borrow occurs here
148 error: cannot borrow `a` as mutable because it is also borrowed as immutable
149 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:33
151 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
152 | -----^^^^^^^---------^
154 | | mutable borrow occurs here
155 | immutable borrow occurs here
157 error: cannot borrow `a` as immutable because it is also borrowed as mutable
158 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:9
160 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
161 | ---------^^^^^^-----^
163 | | immutable borrow occurs here
164 | mutable borrow occurs here
166 error: cannot borrow `a` as immutable because it is also borrowed as mutable
167 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:33
169 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
170 | ---------^^^^^^^-----^
172 | | immutable borrow occurs here
173 | mutable borrow occurs here
175 error: cannot borrow `a` as mutable because it is also borrowed as immutable
176 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:9
178 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
179 | -----^^^^^^---------^
181 | | mutable borrow occurs here
182 | immutable borrow occurs here
184 error: cannot borrow `a` as mutable because it is also borrowed as immutable
185 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:33
187 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
188 | -----^^^^^^^---------^
190 | | mutable borrow occurs here
191 | immutable borrow occurs here
193 error: cannot borrow `a` as immutable because it is also borrowed as mutable
194 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:9
196 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
197 | ---------^^^^^^-----^
199 | | immutable borrow occurs here
200 | mutable borrow occurs here
202 error: cannot borrow `a` as immutable because it is also borrowed as mutable
203 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:33
205 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
206 | ---------^^^^^^^-----^
208 | | immutable borrow occurs here
209 | mutable borrow occurs here
211 error: cannot borrow `a` as mutable because it is also borrowed as immutable
212 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:115:9
214 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
215 | -----^^^^---------^^---------^
217 | | | mutable borrow occurs here
218 | | mutable borrow occurs here
219 | immutable borrow occurs here
221 error: cannot borrow `a` as mutable because it is also borrowed as immutable
222 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:9
224 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
225 | -----^^^^---------^^---------^
227 | | | mutable borrow occurs here
228 | | mutable borrow occurs here
229 | immutable borrow occurs here
231 error: cannot borrow `a` as mutable because it is also borrowed as immutable
232 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:9
234 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
235 | -----^^^^---------^^---------^
237 | | | mutable borrow occurs here
238 | | mutable borrow occurs here
239 | immutable borrow occurs here
241 error: cannot borrow `a` as immutable because it is also borrowed as mutable
242 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:132:9
244 LL | let ref mut a @ (ref b, ref c) = (U, U);
245 | ---------^^^^-----^^-----^
247 | | | immutable borrow occurs here
248 | | immutable borrow occurs here
249 | mutable borrow occurs here
251 error: cannot borrow `a` as mutable because it is also borrowed as immutable
252 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11
254 LL | fn f1(ref a @ ref mut b: U) {}
257 | | mutable borrow occurs here
258 | immutable borrow occurs here
260 error: cannot borrow `a` as immutable because it is also borrowed as mutable
261 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11
263 LL | fn f2(ref mut a @ ref b: U) {}
266 | | immutable borrow occurs here
267 | mutable borrow occurs here
269 error: cannot borrow `a` as mutable because it is also borrowed as immutable
270 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:11
272 LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {}
273 | -----^^^^^^^^^^^----------------^^^^^^^^
275 | | mutable borrow occurs here
276 | immutable borrow occurs here
278 error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
279 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:31
281 LL | ref mut z @ &mut Some(ref a) => {
282 | ----------------------^^^^^-
284 | | immutable borrow occurs here
285 | mutable borrow occurs here
288 | ---------- mutable borrow later used here
290 error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable
291 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:21
293 LL | let ref mut a @ ref b = u();
296 | | immutable borrow occurs here
297 | mutable borrow occurs here
300 | -------- mutable borrow later used here
302 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
303 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:17
305 LL | let ref a @ ref mut b = u();
308 | | mutable borrow occurs here
309 | immutable borrow occurs here
312 | - immutable borrow later used here
314 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
315 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:20
317 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
318 | -----------^^^^^^^^^-
320 | | mutable borrow occurs here
321 | immutable borrow occurs here
324 | - immutable borrow later used here
326 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
327 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:45
329 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => {
330 | ------------^^^^^^^^^-
332 | | mutable borrow occurs here
333 | immutable borrow occurs here
336 | - immutable borrow later used here
338 error[E0594]: cannot assign to `*b`, as it is immutable for the pattern guard
339 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:61
341 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {}
342 | ^^^^^^ cannot assign
344 = note: variables bound in patterns are immutable until the end of the pattern guard
346 error[E0594]: cannot assign to `*a`, as it is immutable for the pattern guard
347 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:61
349 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {}
350 | ^^^^^^^^^^^ cannot assign
352 = note: variables bound in patterns are immutable until the end of the pattern guard
354 error[E0507]: cannot move out of `b` in pattern guard
355 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:66
357 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
358 | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait
360 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
362 error[E0507]: cannot move out of `b` in pattern guard
363 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:66
365 LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {}
366 | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait
368 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
370 error[E0507]: cannot move out of `a` in pattern guard
371 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66
373 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
374 | ^ move occurs because `a` has type `&mut std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait
376 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
378 error[E0507]: cannot move out of `a` in pattern guard
379 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66
381 LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {}
382 | ^ move occurs because `a` has type `&mut std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait
384 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard
386 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
387 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:18
389 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
390 | ---------^^^^^^^^^------------
392 | | mutable borrow occurs here
393 | immutable borrow occurs here
396 | - immutable borrow later used here
398 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
399 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:29
401 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
402 | --------------------^^^^^^^^^-
404 | | mutable borrow occurs here
405 | immutable borrow occurs here
408 | - immutable borrow later used here
410 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
411 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:18
413 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
414 | ---------^^^^^^^^^------------
416 | | mutable borrow occurs here
417 | immutable borrow occurs here
420 | - immutable borrow later used here
422 error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable
423 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:29
425 LL | let ref a @ (ref mut b, ref mut c) = (U, U);
426 | --------------------^^^^^^^^^-
428 | | mutable borrow occurs here
429 | immutable borrow occurs here
432 | - immutable borrow later used here
434 error: aborting due to 45 previous errors
436 Some errors have detailed explanations: E0502, E0507, E0594.
437 For more information about an error, try `rustc --explain E0502`.