fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0521]: borrowed data escapes outside of closure 2 --> $DIR/regions-nested-fns.rs:12:9 3 | 4LL | let mut ay = &y; 5 | ------ `ay` declared here, outside of the closure body 6... 7LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| { 8 | - `z` is a reference that is only valid in the closure body 9... 10LL | ay = z; 11 | ^^^^^^ `z` escapes the closure body here 12 13error[E0597]: `y` does not live long enough 14 --> $DIR/regions-nested-fns.rs:5:18 15 | 16LL | let y = 3; 17 | - binding `y` declared here 18LL | let mut ay = &y; 19 | ^^ borrowed value does not live long enough 20... 21LL | if false { return ay; } 22 | -- returning this value requires that `y` is borrowed for `'static` 23... 24LL | } 25 | - `y` dropped here while still borrowed 26 27error[E0597]: `y` does not live long enough 28 --> $DIR/regions-nested-fns.rs:10:15 29 | 30LL | ignore::<Box<dyn for<'z> FnMut(&'z isize)>>(Box::new(|z| { 31 | --- value captured here 32LL | ay = x; 33LL | ay = &y; 34 | ^ borrowed value does not live long enough 35... 36LL | if false { return ay; } 37 | -- returning this value requires that `y` is borrowed for `'static` 38... 39LL | } 40 | - `y` dropped here while still borrowed 41 42error: lifetime may not live long enough 43 --> $DIR/regions-nested-fns.rs:17:27 44 | 45LL | fn nested<'x>(x: &'x isize) { 46 | -- lifetime `'x` defined here 47... 48LL | if false { return x; } 49 | ^ returning this value requires that `'x` must outlive `'static` 50 51error: aborting due to 4 previous errors 52 53Some errors have detailed explanations: E0521, E0597. 54For more information about an error, try `rustc --explain E0521`.