fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
15.1 KiB372 linesraw
1error: cannot borrow value as mutable more than once at a time
2  --> $DIR/borrowck-pat-ref-mut-twice.rs:28:9
3   |
4LL |     let ref mut a @ ref mut b = U;
5   |         ---------^^^---------
6   |         |           |
7   |         |           another mutable borrow, by `b`, occurs here
8   |         first mutable borrow, by `a`, occurs here
9
10error: cannot borrow value as mutable more than once at a time
11  --> $DIR/borrowck-pat-ref-mut-twice.rs:32:9
12   |
13LL |     let ref mut a @ ref mut b = U;
14   |         ---------^^^---------
15   |         |           |
16   |         |           another mutable borrow, by `b`, occurs here
17   |         first mutable borrow, by `a`, occurs here
18
19error: cannot borrow value as mutable more than once at a time
20  --> $DIR/borrowck-pat-ref-mut-twice.rs:35:9
21   |
22LL |     let ref mut a @ ref mut b = U;
23   |         ---------^^^---------
24   |         |           |
25   |         |           another mutable borrow, by `b`, occurs here
26   |         first mutable borrow, by `a`, occurs here
27
28error: cannot borrow value as mutable more than once at a time
29  --> $DIR/borrowck-pat-ref-mut-twice.rs:38:9
30   |
31LL |     let ref mut a @ ref mut b = U;
32   |         ---------^^^---------
33   |         |           |
34   |         |           another mutable borrow, by `b`, occurs here
35   |         first mutable borrow, by `a`, occurs here
36
37error: cannot borrow value as mutable more than once at a time
38  --> $DIR/borrowck-pat-ref-mut-twice.rs:42:9
39   |
40LL |     let ref mut a @ ref mut b = U;
41   |         ---------^^^---------
42   |         |           |
43   |         |           another mutable borrow, by `b`, occurs here
44   |         first mutable borrow, by `a`, occurs here
45
46error: cannot borrow value as mutable more than once at a time
47  --> $DIR/borrowck-pat-ref-mut-twice.rs:46:9
48   |
49LL |       let ref mut a @ (
50   |           ^--------
51   |           |
52   |  _________first mutable borrow, by `a`, occurs here
53   | |
54LL | |
55LL | |         ref mut b,
56   | |         --------- another mutable borrow, by `b`, occurs here
57LL | |         [
58LL | |             ref mut c,
59   | |             --------- another mutable borrow, by `c`, occurs here
60LL | |             ref mut d,
61   | |             --------- another mutable borrow, by `d`, occurs here
62LL | |             ref e,
63   | |             ----- also borrowed as immutable, by `e`, here
64LL | |         ]
65LL | |     ) = (U, [U, U, U]);
66   | |_____^
67
68error: cannot borrow value as mutable more than once at a time
69  --> $DIR/borrowck-pat-ref-mut-twice.rs:56:9
70   |
71LL |       let ref mut a @ (
72   |           ^--------
73   |           |
74   |  _________first mutable borrow, by `a`, occurs here
75   | |
76LL | |
77LL | |             ref mut b,
78   | |             --------- another mutable borrow, by `b`, occurs here
79LL | |             [
80LL | |                 ref mut c,
81   | |                 --------- another mutable borrow, by `c`, occurs here
82LL | |                 ref mut d,
83   | |                 --------- another mutable borrow, by `d`, occurs here
84LL | |                 ref e,
85   | |                 ----- also borrowed as immutable, by `e`, here
86LL | |             ]
87LL | |         ) = (u(), [u(), u(), u()]);
88   | |_________^
89
90error: borrow of moved value
91  --> $DIR/borrowck-pat-ref-mut-twice.rs:66:9
92   |
93LL |     let a @ (ref mut b, ref mut c) = (U, U);
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
103   |
104LL |     let a @ (b, [c, d]) = &mut val; // Same as ^--
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
112
113error: borrow of moved value
114  --> $DIR/borrowck-pat-ref-mut-twice.rs:74:9
115   |
116LL |     let a @ &mut ref mut b = &mut U;
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
122
123error: borrow of moved value
124  --> $DIR/borrowck-pat-ref-mut-twice.rs:77:9
125   |
126LL |     let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
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
133
134error: cannot borrow value as mutable more than once at a time
135  --> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
136   |
137LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
138   |         ---------^^^^^^---------^
139   |         |              |
140   |         |              another mutable borrow, by `b`, occurs here
141   |         first mutable borrow, by `a`, occurs here
142
143error: cannot borrow value as mutable more than once at a time
144  --> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
145   |
146LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
147   |                                     ---------^^^^^^^---------^
148   |                                     |               |
149   |                                     |               another mutable borrow, by `b`, occurs here
150   |                                     first mutable borrow, by `a`, occurs here
151
152error: cannot borrow value as mutable more than once at a time
153  --> $DIR/borrowck-pat-ref-mut-twice.rs:88:9
154   |
155LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
156   |         ---------^^^^^^---------^
157   |         |              |
158   |         |              another mutable borrow, by `b`, occurs here
159   |         first mutable borrow, by `a`, occurs here
160
161error: cannot borrow value as mutable more than once at a time
162  --> $DIR/borrowck-pat-ref-mut-twice.rs:88:37
163   |
164LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
165   |                                     ---------^^^^^^^---------^
166   |                                     |               |
167   |                                     |               another mutable borrow, by `b`, occurs here
168   |                                     first mutable borrow, by `a`, occurs here
169
170error: cannot borrow value as mutable more than once at a time
171  --> $DIR/borrowck-pat-ref-mut-twice.rs:95:9
172   |
173LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
174   |         ---------^^^^^^---------^
175   |         |              |
176   |         |              another mutable borrow, by `b`, occurs here
177   |         first mutable borrow, by `a`, occurs here
178
179error: cannot borrow value as mutable more than once at a time
180  --> $DIR/borrowck-pat-ref-mut-twice.rs:95:37
181   |
182LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
183   |                                     ---------^^^^^^^---------^
184   |                                     |               |
185   |                                     |               another mutable borrow, by `b`, occurs here
186   |                                     first mutable borrow, by `a`, occurs here
187
188error: cannot borrow value as mutable more than once at a time
189  --> $DIR/borrowck-pat-ref-mut-twice.rs:107:9
190   |
191LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
192   |         ---------^^^^^^---------^
193   |         |              |
194   |         |              another mutable borrow, by `b`, occurs here
195   |         first mutable borrow, by `a`, occurs here
196
197error: cannot borrow value as mutable more than once at a time
198  --> $DIR/borrowck-pat-ref-mut-twice.rs:107:37
199   |
200LL |         ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
201   |                                     ---------^^^^^^^---------^
202   |                                     |               |
203   |                                     |               another mutable borrow, by `b`, occurs here
204   |                                     first mutable borrow, by `a`, occurs here
205
206error: cannot borrow value as mutable more than once at a time
207  --> $DIR/borrowck-pat-ref-mut-twice.rs:11:11
208   |
209LL |     fn f1(ref mut a @ ref mut b: U) {}
210   |           ---------^^^---------
211   |           |           |
212   |           |           another mutable borrow, by `b`, occurs here
213   |           first mutable borrow, by `a`, occurs here
214
215error: cannot borrow value as mutable more than once at a time
216  --> $DIR/borrowck-pat-ref-mut-twice.rs:13:11
217   |
218LL |     fn f2(ref mut a @ ref mut b: U) {}
219   |           ---------^^^---------
220   |           |           |
221   |           |           another mutable borrow, by `b`, occurs here
222   |           first mutable borrow, by `a`, occurs here
223
224error: cannot borrow value as mutable more than once at a time
225  --> $DIR/borrowck-pat-ref-mut-twice.rs:16:9
226   |
227LL |           ref mut a @ [
228   |           ^--------
229   |           |
230   |  _________first mutable borrow, by `a`, occurs here
231   | |
232LL | |
233LL | |             [ref b @ .., _],
234   | |              ---------- also borrowed as immutable, by `b`, here
235LL | |             [_, ref mut mid @ ..],
236   | |                 ---------------- another mutable borrow, by `mid`, occurs here
237LL | |             ..,
238LL | |             [..],
239LL | |         ] : [[U; 4]; 5]
240   | |_________^
241
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
261error[E0499]: cannot borrow `_` as mutable more than once at a time
262  --> $DIR/borrowck-pat-ref-mut-twice.rs:28:21
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
273error[E0499]: cannot borrow `_` as mutable more than once at a time
274  --> $DIR/borrowck-pat-ref-mut-twice.rs:38:21
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
286  --> $DIR/borrowck-pat-ref-mut-twice.rs:66:25
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
295  --> $DIR/borrowck-pat-ref-mut-twice.rs:70:21
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
304  --> $DIR/borrowck-pat-ref-mut-twice.rs:74:18
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
313  --> $DIR/borrowck-pat-ref-mut-twice.rs:77:30
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
321error[E0499]: cannot borrow `_` as mutable more than once at a time
322  --> $DIR/borrowck-pat-ref-mut-twice.rs:95:24
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
333error[E0499]: cannot borrow `_` as mutable more than once at a time
334  --> $DIR/borrowck-pat-ref-mut-twice.rs:95:53
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
345error[E0499]: cannot borrow `_` as mutable more than once at a time
346  --> $DIR/borrowck-pat-ref-mut-twice.rs:107:24
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
357error[E0499]: cannot borrow `_` as mutable more than once at a time
358  --> $DIR/borrowck-pat-ref-mut-twice.rs:107:53
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
369error: aborting due to 34 previous errors
370
371Some errors have detailed explanations: E0382, E0499.
372For more information about an error, try `rustc --explain E0382`.