]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-nested-fns.nll.stderr
Fixed off-by-one span.
[rust.git] / src / test / ui / regions / regions-nested-fns.nll.stderr
1 error: borrowed data escapes outside of closure
2   --> $DIR/regions-nested-fns.rs:20:9
3    |
4 LL |     let mut ay = &y; //~ ERROR E0495
5    |         ------ `ay` is declared here, outside of the closure body
6 LL | 
7 LL |     ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
8    |                                                       - `z` is a reference that is only valid in the closure body
9 ...
10 LL |         ay = z;
11    |         ^^^^^^ `z` escapes the closure body here
12
13 error[E0597]: `y` does not live long enough
14   --> $DIR/regions-nested-fns.rs:15:18
15    |
16 LL |     let mut ay = &y; //~ ERROR E0495
17    |                  ^^ borrowed value does not live long enough
18 ...
19 LL | }
20    | - `y` dropped here while still borrowed
21    |
22    = note: borrowed value must be valid for the static lifetime...
23
24 error[E0597]: `y` does not live long enough
25   --> $DIR/regions-nested-fns.rs:19:15
26    |
27 LL |     ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
28    |                                                       - has type `&'0 isize`
29 LL |         ay = x;
30 LL |         ay = &y;
31    |               ^ `y` would have to be valid for `'0`
32 ...
33 LL | }
34    | - ...but `y` is only valid for the duration of the `nested` function, so it is dropped here while still borrowed
35
36 error: unsatisfied lifetime constraints
37   --> $DIR/regions-nested-fns.rs:23:68
38    |
39 LL |   fn nested<'x>(x: &'x isize) {
40    |             -- lifetime `'x` defined here
41 ...
42 LL |       ignore::< Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
43    |  ____________________________________________________________________^
44 LL | |         if false { return x; } //~ ERROR E0312
45 LL | |         if false { return ay; }
46 LL | |         return z;
47 LL | |     }));
48    | |_____^ closure body requires that `'x` must outlive `'static`
49
50 error: aborting due to 4 previous errors
51
52 For more information about this error, try `rustc --explain E0597`.