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