error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements --> tests/compile_fail/circular.rs:21:40 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined here... --> tests/compile_fail/circular.rs:21:69 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^ note: ...so that the type `Bar<'_>` is not borrowed for too long --> tests/compile_fail/circular.rs:21:45 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ note: but, the lifetime must be valid for the anonymous lifetime #1 defined here... --> tests/compile_fail/circular.rs:20:29 | 20 | selfie.with_referential(|referential| { | _____________________________^ 21 | | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); 22 | | }); | |_____^ note: ...so that the expression is assignable --> tests/compile_fail/circular.rs:21:40 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: expected `Option<&Bar<'_>>` found `Option<&Bar<'_>>` error[E0308]: mismatched types --> tests/compile_fail/circular.rs:21:45 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected reference `&Bar<'_>` found reference `&Bar<'_>` note: the anonymous lifetime #1 defined here... --> tests/compile_fail/circular.rs:21:69 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^ note: ...does not necessarily outlive the anonymous lifetime #1 defined here --> tests/compile_fail/circular.rs:20:29 | 20 | selfie.with_referential(|referential| { | _____________________________^ 21 | | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); 22 | | }); | |_____^ error[E0308]: mismatched types --> tests/compile_fail/circular.rs:21:45 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch | = note: expected reference `&Bar<'_>` found reference `&Bar<'_>` note: the anonymous lifetime #1 defined here... --> tests/compile_fail/circular.rs:20:29 | 20 | selfie.with_referential(|referential| { | _____________________________^ 21 | | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); 22 | | }); | |_____^ note: ...does not necessarily outlive the anonymous lifetime #1 defined here --> tests/compile_fail/circular.rs:21:69 | 21 | referential.0.borrow_mut().0 = Some(selfie.with_referential(|r| r)); | ^^^^^