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