fork/rust

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

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

master
12.3 KiB372 linesraw
1error[E0499]: cannot borrow `x` as mutable more than once at a time
2  --> $DIR/borrowck-describe-lvalue.rs:254:13
3   |
4LL |             let y = &mut x;
5   |                     ------ first mutable borrow occurs here
6LL |             &mut x;
7   |             ^^^^^^ second mutable borrow occurs here
8LL |             *y = 1;
9   |             ------ first borrow later used here
10
11error[E0499]: cannot borrow `x` as mutable more than once at a time
12  --> $DIR/borrowck-describe-lvalue.rs:264:20
13   |
14LL |                    let y = &mut x;
15   |                            ------ first mutable borrow occurs here
16LL |                    &mut x;
17   |                    ^^^^^^ second mutable borrow occurs here
18LL |                    *y = 1;
19   |                    ------ first borrow later used here
20
21error: captured variable cannot escape `FnMut` closure body
22  --> $DIR/borrowck-describe-lvalue.rs:262:16
23   |
24LL |           let mut x = 0;
25   |               ----- variable defined here
26LL |              || {
27   |               - inferred to be a `FnMut` closure
28LL | /                || {
29LL | |                    let y = &mut x;
30   | |                                 - variable captured here
31LL | |                    &mut x;
32LL | |                    *y = 1;
33LL | |                    drop(y);
34LL | |                 }
35   | |_________________^ returns a closure that contains a reference to a captured variable, which then escapes the closure body
36   |
37   = note: `FnMut` closures only have access to their captured variables while they are executing...
38   = note: ...therefore, they cannot allow references to captured variables to escape
39help: consider adding 'move' keyword before the nested closure
40   |
41LL |                move || {
42   |                ++++
43
44error[E0503]: cannot use `f.x` because it was mutably borrowed
45  --> $DIR/borrowck-describe-lvalue.rs:37:9
46   |
47LL |         let x = f.x();
48   |                 - `f` is borrowed here
49LL |         f.x;
50   |         ^^^ use of borrowed `f`
51LL |         drop(x);
52   |              - borrow later used here
53
54error[E0503]: cannot use `g.0` because it was mutably borrowed
55  --> $DIR/borrowck-describe-lvalue.rs:44:9
56   |
57LL |         let x = g.x();
58   |                 - `g` is borrowed here
59LL |         g.0;
60   |         ^^^ use of borrowed `g`
61LL |         drop(x);
62   |              - borrow later used here
63
64error[E0503]: cannot use `h.0` because it was mutably borrowed
65  --> $DIR/borrowck-describe-lvalue.rs:51:9
66   |
67LL |         let x = &mut h.0;
68   |                 -------- `h.0` is borrowed here
69LL |         h.0;
70   |         ^^^ use of borrowed `h.0`
71LL |         drop(x);
72   |              - borrow later used here
73
74error[E0503]: cannot use `e.0` because it was mutably borrowed
75  --> $DIR/borrowck-describe-lvalue.rs:59:20
76   |
77LL |         let x = e.x();
78   |                 - `e` is borrowed here
79LL |         match e {
80LL |             Baz::X(value) => value
81   |                    ^^^^^ use of borrowed `e`
82LL |         };
83LL |         drop(x);
84   |              - borrow later used here
85
86error[E0503]: cannot use `u.a` because it was mutably borrowed
87  --> $DIR/borrowck-describe-lvalue.rs:67:9
88   |
89LL |         let x = &mut u.a;
90   |                 -------- `u.a` is borrowed here
91LL |         u.a;
92   |         ^^^ use of borrowed `u.a`
93LL |         drop(x);
94   |              - borrow later used here
95
96error[E0503]: cannot use `f.x` because it was mutably borrowed
97  --> $DIR/borrowck-describe-lvalue.rs:74:9
98   |
99LL |         let x = f.x();
100   |                 - `*f` is borrowed here
101LL |         f.x;
102   |         ^^^ use of borrowed `*f`
103LL |         drop(x);
104   |              - borrow later used here
105
106error[E0503]: cannot use `g.0` because it was mutably borrowed
107  --> $DIR/borrowck-describe-lvalue.rs:81:9
108   |
109LL |         let x = g.x();
110   |                 - `*g` is borrowed here
111LL |         g.0;
112   |         ^^^ use of borrowed `*g`
113LL |         drop(x);
114   |              - borrow later used here
115
116error[E0503]: cannot use `h.0` because it was mutably borrowed
117  --> $DIR/borrowck-describe-lvalue.rs:88:9
118   |
119LL |         let x = &mut h.0;
120   |                 -------- `h.0` is borrowed here
121LL |         h.0;
122   |         ^^^ use of borrowed `h.0`
123LL |         drop(x);
124   |              - borrow later used here
125
126error[E0503]: cannot use `e.0` because it was mutably borrowed
127  --> $DIR/borrowck-describe-lvalue.rs:96:20
128   |
129LL |         let x = e.x();
130   |                 - `*e` is borrowed here
131LL |         match *e {
132LL |             Baz::X(value) => value
133   |                    ^^^^^ use of borrowed `*e`
134...
135LL |         drop(x);
136   |              - borrow later used here
137
138error[E0503]: cannot use `u.a` because it was mutably borrowed
139  --> $DIR/borrowck-describe-lvalue.rs:105:9
140   |
141LL |         let x = &mut u.a;
142   |                 -------- `u.a` is borrowed here
143LL |         u.a;
144   |         ^^^ use of borrowed `u.a`
145LL |         drop(x);
146   |              - borrow later used here
147
148error[E0503]: cannot use `v[..]` because it was mutably borrowed
149  --> $DIR/borrowck-describe-lvalue.rs:113:15
150   |
151LL |         let x = &mut v;
152   |                 ------ `v` is borrowed here
153LL |         match v {
154LL |             &[x, _, .., _, _] => println!("{}", x),
155   |               ^ use of borrowed `v`
156...
157LL |         drop(x);
158   |              - borrow later used here
159
160error[E0503]: cannot use `v[..]` because it was mutably borrowed
161  --> $DIR/borrowck-describe-lvalue.rs:118:18
162   |
163LL |         let x = &mut v;
164   |                 ------ `v` is borrowed here
165...
166LL |             &[_, x, .., _, _] => println!("{}", x),
167   |                  ^ use of borrowed `v`
168...
169LL |         drop(x);
170   |              - borrow later used here
171
172error[E0503]: cannot use `v[..]` because it was mutably borrowed
173  --> $DIR/borrowck-describe-lvalue.rs:123:25
174   |
175LL |         let x = &mut v;
176   |                 ------ `v` is borrowed here
177...
178LL |             &[_, _, .., x, _] => println!("{}", x),
179   |                         ^ use of borrowed `v`
180...
181LL |         drop(x);
182   |              - borrow later used here
183
184error[E0503]: cannot use `v[..]` because it was mutably borrowed
185  --> $DIR/borrowck-describe-lvalue.rs:128:28
186   |
187LL |         let x = &mut v;
188   |                 ------ `v` is borrowed here
189...
190LL |             &[_, _, .., _, x] => println!("{}", x),
191   |                            ^ use of borrowed `v`
192...
193LL |         drop(x);
194   |              - borrow later used here
195
196error[E0503]: cannot use `v[..]` because it was mutably borrowed
197  --> $DIR/borrowck-describe-lvalue.rs:139:15
198   |
199LL |         let x = &mut v;
200   |                 ------ `v` is borrowed here
201LL |         match v {
202LL |             &[x @ ..] => println!("{:?}", x),
203   |               ^ use of borrowed `v`
204...
205LL |         drop(x);
206   |              - borrow later used here
207
208error[E0503]: cannot use `v[..]` because it was mutably borrowed
209  --> $DIR/borrowck-describe-lvalue.rs:144:18
210   |
211LL |         let x = &mut v;
212   |                 ------ `v` is borrowed here
213...
214LL |             &[_, x @ ..] => println!("{:?}", x),
215   |                  ^ use of borrowed `v`
216...
217LL |         drop(x);
218   |              - borrow later used here
219
220error[E0503]: cannot use `v[..]` because it was mutably borrowed
221  --> $DIR/borrowck-describe-lvalue.rs:149:15
222   |
223LL |         let x = &mut v;
224   |                 ------ `v` is borrowed here
225...
226LL |             &[x @ .., _] => println!("{:?}", x),
227   |               ^ use of borrowed `v`
228...
229LL |         drop(x);
230   |              - borrow later used here
231
232error[E0503]: cannot use `v[..]` because it was mutably borrowed
233  --> $DIR/borrowck-describe-lvalue.rs:154:18
234   |
235LL |         let x = &mut v;
236   |                 ------ `v` is borrowed here
237...
238LL |             &[_, x @ .., _] => println!("{:?}", x),
239   |                  ^ use of borrowed `v`
240...
241LL |         drop(x);
242   |              - borrow later used here
243
244error[E0503]: cannot use `e` because it was mutably borrowed
245  --> $DIR/borrowck-describe-lvalue.rs:166:15
246   |
247LL |         let x = &mut e;
248   |                 ------ `e` is borrowed here
249LL |         match e {
250   |               ^ use of borrowed `e`
251...
252LL |         drop(x);
253   |              - borrow later used here
254
255error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
256  --> $DIR/borrowck-describe-lvalue.rs:168:18
257   |
258LL |         let x = &mut e;
259   |                 ------ mutable borrow occurs here
260...
261LL |             E::A(ref ax) =>
262   |                  ^^^^^^ immutable borrow occurs here
263...
264LL |         drop(x);
265   |              - mutable borrow later used here
266
267error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
268  --> $DIR/borrowck-describe-lvalue.rs:171:23
269   |
270LL |         let x = &mut e;
271   |                 ------ mutable borrow occurs here
272...
273LL |             E::B { x: ref bx } =>
274   |                       ^^^^^^ immutable borrow occurs here
275...
276LL |         drop(x);
277   |              - mutable borrow later used here
278
279error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
280  --> $DIR/borrowck-describe-lvalue.rs:184:22
281   |
282LL |         let x = &mut s;
283   |                 ------ mutable borrow occurs here
284LL |         match s {
285LL |             S  { y: (ref y0, _), .. } =>
286   |                      ^^^^^^ immutable borrow occurs here
287...
288LL |         drop(x);
289   |              - mutable borrow later used here
290
291error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
292  --> $DIR/borrowck-describe-lvalue.rs:190:28
293   |
294LL |         let x = &mut s;
295   |                 ------ mutable borrow occurs here
296...
297LL |             S  { x: F { y: ref x0, .. }, .. } =>
298   |                            ^^^^^^ immutable borrow occurs here
299...
300LL |         drop(x);
301   |              - mutable borrow later used here
302
303error[E0503]: cannot use `*v` because it was mutably borrowed
304  --> $DIR/borrowck-describe-lvalue.rs:232:9
305   |
306LL |         let x = &mut v;
307   |                 ------ `v` is borrowed here
308LL |         v[0].y;
309   |         ^^^^ use of borrowed `v`
310...
311LL |         drop(x);
312   |              - borrow later used here
313
314error[E0503]: cannot use `v[_].y` because it was mutably borrowed
315  --> $DIR/borrowck-describe-lvalue.rs:232:9
316   |
317LL |         let x = &mut v;
318   |                 ------ `v` is borrowed here
319LL |         v[0].y;
320   |         ^^^^^^ use of borrowed `v`
321...
322LL |         drop(x);
323   |              - borrow later used here
324
325error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
326  --> $DIR/borrowck-describe-lvalue.rs:243:24
327   |
328LL |         let x = &mut v;
329   |                 ------ mutable borrow occurs here
330LL |         match v {
331LL |             &[_, F {x: ref xf, ..}] => println!("{}", xf),
332   |                        ^^^^^^ immutable borrow occurs here
333...
334LL |         drop(x);
335   |              - mutable borrow later used here
336
337error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
338  --> $DIR/borrowck-describe-lvalue.rs:206:29
339   |
340LL |             let x = &mut block;
341   |                     ---------- mutable borrow occurs here
342LL |             let p: &'a u8 = &*block.current;
343   |                             ^^^^^^^^^^^^^^^ immutable borrow occurs here
344...
345LL |             drop(x);
346   |                  - mutable borrow later used here
347
348error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
349  --> $DIR/borrowck-describe-lvalue.rs:221:33
350   |
351LL |             let x = &mut block;
352   |                     ---------- mutable borrow occurs here
353LL |             let p : *const u8 = &*(*block).current;
354   |                                 ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
355...
356LL |             drop(x);
357   |                  - mutable borrow later used here
358
359error[E0382]: use of moved value: `x`
360  --> $DIR/borrowck-describe-lvalue.rs:274:22
361   |
362LL |                 drop(x);
363   |                      - value moved here
364LL |                 drop(x);
365   |                      ^ value used here after move
366   |
367   = note: move occurs because `x` has type `Vec<i32>`, which does not implement the `Copy` trait
368
369error: aborting due to 32 previous errors
370
371Some errors have detailed explanations: E0382, E0499, E0502, E0503.
372For more information about an error, try `rustc --explain E0382`.