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