error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> src/fail_tests/move_ref_outside_closure.rs:16:48
|
16 | instance.with_data_ref(|dref| stored_ref = Some(*dref));
| ^^^^^^^^^^^
|
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here...
--> src/fail_tests/move_ref_outside_closure.rs:16:28
|
16 | instance.with_data_ref(|dref| stored_ref = Some(*dref));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...so that reference does not outlive borrowed content
--> src/fail_tests/move_ref_outside_closure.rs:16:53
|
16 | instance.with_data_ref(|dref| stored_ref = Some(*dref));
| ^^^^^
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the expression is assignable
--> src/fail_tests/move_ref_outside_closure.rs:16:48
|
16 | instance.with_data_ref(|dref| stored_ref = Some(*dref));
| ^^^^^^^^^^^
= note: expected `Option<&'static i32>`
found `Option<&i32>`