error: borrowed data escapes outside of closure --> $DIR/regions-nested-fns.rs:20:9 | LL | let mut ay = &y; //~ ERROR E0495 | ------ `ay` is declared here, outside of the closure body LL | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | - `z` is a reference that is only valid in the closure body ... LL | ay = z; | ^^^^^^ `z` escapes the closure body here error[E0597]: `y` does not live long enough --> $DIR/regions-nested-fns.rs:15:18 | LL | let mut ay = &y; //~ ERROR E0495 | ^^ borrowed value does not live long enough ... LL | } | - `y` dropped here while still borrowed | = note: borrowed value must be valid for the static lifetime... error[E0597]: `y` does not live long enough --> $DIR/regions-nested-fns.rs:19:15 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | --- value captured here LL | ay = x; LL | ay = &y; | ^ borrowed value does not live long enough ... LL | } | - `y` dropped here while still borrowed | = note: borrowed value must be valid for the static lifetime... error: unsatisfied lifetime constraints --> $DIR/regions-nested-fns.rs:23:68 | LL | fn nested<'x>(x: &'x isize) { | -- lifetime `'x` defined here ... LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ____________________________________________________________________^ LL | | if false { return x; } //~ ERROR E0312 LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ closure body requires that `'x` must outlive `'static` error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0597`.