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