fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

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