blob: 3cecd4ee83ca5ca8690ed9e2a4f602af12de43fe [file] [log] [blame]
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:54...
--> $DIR/regions-nested-fns.rs:7:54
|
LL | ignore::<Box<for<'z> 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:68...
--> $DIR/regions-nested-fns.rs:13:68
|
LL | ignore::< Box<for<'z> 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:68...
--> $DIR/regions-nested-fns.rs:13:68
|
LL | ignore::< Box<for<'z> 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
Some errors occurred: E0312, E0495.
For more information about an error, try `rustc --explain E0312`.