#[derive(Copy, Clone)]
struct Invariant<'a>(std::marker::PhantomData<&'a mut &'a ()>);
impl<'a> Invariant<'a> {
fn lazy_dup(self) -> impl Fn() -> (Invariant<'a>, Self) {
|| (self, self)
}
}
error[E0308]: mismatched types
--> src/lib.rs:6:19
|
6 | || (self, self)
| ^^^^ lifetime mismatch
|
= note: expected type `Invariant<'static>`
found type `Invariant<'a>`
I didn't write 'static anywhere - it comes from part of the implementation of impl Trait, and Self references lifetimes (from the impl header) "indirectly", hiding them from impl Trait logic.
cc @cramertj @oli-obk @nikomatsakis
I didn't write
'staticanywhere - it comes from part of the implementation ofimpl Trait, andSelfreferences lifetimes (from theimplheader) "indirectly", hiding them fromimpl Traitlogic.cc @cramertj @oli-obk @nikomatsakis