]> git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/borrowck-describe-lvalue.stderr
New upstream version 1.56.0~beta.4+dfsg1
[rustc.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:166:15
242 |
243 LL | let x = &mut e;
244 | ------ borrow of `e` occurs here
245 LL | match e {
246 | ^ use of borrowed `e`
247 ...
248 LL | drop(x);
249 | - borrow later used here
250
251 error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
252 --> $DIR/borrowck-describe-lvalue.rs:168:18
253 |
254 LL | let x = &mut e;
255 | ------ mutable borrow occurs here
256 ...
257 LL | E::A(ref ax) =>
258 | ^^^^^^ immutable borrow occurs here
259 ...
260 LL | drop(x);
261 | - mutable borrow later used here
262
263 error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
264 --> $DIR/borrowck-describe-lvalue.rs:171:23
265 |
266 LL | let x = &mut e;
267 | ------ mutable borrow occurs here
268 ...
269 LL | E::B { x: ref bx } =>
270 | ^^^^^^ immutable borrow occurs here
271 ...
272 LL | drop(x);
273 | - mutable borrow later used here
274
275 error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
276 --> $DIR/borrowck-describe-lvalue.rs:184:22
277 |
278 LL | let x = &mut s;
279 | ------ mutable borrow occurs here
280 LL | match s {
281 LL | S { y: (ref y0, _), .. } =>
282 | ^^^^^^ immutable borrow occurs here
283 ...
284 LL | drop(x);
285 | - mutable borrow later used here
286
287 error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
288 --> $DIR/borrowck-describe-lvalue.rs:190:28
289 |
290 LL | let x = &mut s;
291 | ------ mutable borrow occurs here
292 ...
293 LL | S { x: F { y: ref x0, .. }, .. } =>
294 | ^^^^^^ immutable borrow occurs here
295 ...
296 LL | drop(x);
297 | - mutable borrow later used here
298
299 error[E0503]: cannot use `*v` because it was mutably borrowed
300 --> $DIR/borrowck-describe-lvalue.rs:232:9
301 |
302 LL | let x = &mut v;
303 | ------ borrow of `v` occurs here
304 LL | v[0].y;
305 | ^^^^ use of borrowed `v`
306 ...
307 LL | drop(x);
308 | - borrow later used here
309
310 error[E0503]: cannot use `v[_].y` because it was mutably borrowed
311 --> $DIR/borrowck-describe-lvalue.rs:232: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[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
322 --> $DIR/borrowck-describe-lvalue.rs:243:24
323 |
324 LL | let x = &mut v;
325 | ------ mutable borrow occurs here
326 LL | match v {
327 LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
328 | ^^^^^^ immutable borrow occurs here
329 ...
330 LL | drop(x);
331 | - mutable borrow later used here
332
333 error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
334 --> $DIR/borrowck-describe-lvalue.rs:206:29
335 |
336 LL | let x = &mut block;
337 | ---------- mutable borrow occurs here
338 LL | let p: &'a u8 = &*block.current;
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:221:33
346 |
347 LL | let x = &mut block;
348 | ---------- mutable borrow occurs here
349 LL | let p : *const u8 = &*(*block).current;
350 | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
351 ...
352 LL | drop(x);
353 | - mutable borrow later used here
354
355 error[E0382]: use of moved value: `x`
356 --> $DIR/borrowck-describe-lvalue.rs:274:22
357 |
358 LL | drop(x);
359 | - value moved here
360 LL | drop(x);
361 | ^ value used here after move
362 |
363 = note: move occurs because `x` has type `Vec<i32>`, which does not implement the `Copy` trait
364
365 error: aborting due to 32 previous errors
366
367 Some errors have detailed explanations: E0382, E0499, E0502, E0503.
368 For more information about an error, try `rustc --explain E0382`.