error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | LL | let mut f = || &mut x; //~ ERROR cannot infer | ^^^^^^ | note: first, the lifetime cannot outlive the lifetime as defined on the body at 7:21... --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:21 | LL | let mut f = || &mut x; //~ ERROR cannot infer | ^^^^^^^^^ note: ...so that closure can access `x` --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24 | LL | let mut f = || &mut x; //~ ERROR cannot infer | ^^^^^^ note: but, the lifetime must be valid for the call at 9:17... --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17 | LL | let y = f(); | ^^^ note: ...so type `&mut i32` of expression is valid during the expression --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17 | LL | let y = f(); | ^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0495`.