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