error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> $DIR/regions-nested-fns.rs:5:18 | LL | let mut ay = &y; | ^^ | note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 7:58... --> $DIR/regions-nested-fns.rs:7:58 | LL | ignore:: FnMut(&'z isize)>>(Box::new(|z| { | __________________________________________________________^ LL | | ay = x; LL | | ay = &y; LL | | ay = z; LL | | })); | |_____^ note: ...so that reference does not outlive borrowed content --> $DIR/regions-nested-fns.rs:10:14 | LL | ay = z; | ^ note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 13:72... --> $DIR/regions-nested-fns.rs:13:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ________________________________________________________________________^ LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ = note: ...so that the types are compatible: expected &isize found &isize error[E0312]: lifetime of reference outlives lifetime of borrowed content... --> $DIR/regions-nested-fns.rs:14:27 | LL | if false { return x; } | ^ | note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 13:72... --> $DIR/regions-nested-fns.rs:13:72 | LL | ignore::< Box FnMut(&'z isize) -> &'z isize>>(Box::new(|z| { | ________________________________________________________________________^ LL | | if false { return x; } LL | | if false { return ay; } LL | | return z; LL | | })); | |_____^ note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 3:11 --> $DIR/regions-nested-fns.rs:3:11 | LL | fn nested<'x>(x: &'x isize) { | ^^ error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0312`.