]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr
946465bcb5f261a4437b307d33c4e954907d5187
[rust.git] / src / test / ui / regions / regions-return-ref-to-upvar-issue-17403.stderr
1 error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
2   --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24
3    |
4 LL |         let mut f = || &mut x;
5    |                        ^^^^^^
6    |
7 note: first, the lifetime cannot outlive the lifetime `'_` as defined on the body at 7:21...
8   --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:21
9    |
10 LL |         let mut f = || &mut x;
11    |                     ^^^^^^^^^
12 note: ...so that closure can access `x`
13   --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24
14    |
15 LL |         let mut f = || &mut x;
16    |                        ^^^^^^
17 note: but, the lifetime must be valid for the call at 9:17...
18   --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17
19    |
20 LL |         let y = f();
21    |                 ^^^
22 note: ...so type `&mut i32` of expression is valid during the expression
23   --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:9:17
24    |
25 LL |         let y = f();
26    |                 ^^^
27
28 error: aborting due to previous error
29
30 For more information about this error, try `rustc --explain E0495`.