fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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