So I'm trying to use some functionality from a crate that has higher ranked trait bounds, leaving only the important part it looks like this:
trait Trait<'a> { /* ... */ }
struct Interface<'a, Generic: for<'b> Trait<'b>> { /* ...*/ }
And I am trying to use it like this:
// This is my implementation
struct Struct<'a> { /* ... */ }
impl<'a> Trait<'a> for Struct<'a> { /* ... */ }
struct StructInWhichToStoreMyInteface<'a> {
interface: Interface<'a, Struct<'a>>,
}
So my first question would be, why exactly this fails, since I can't wrap my head around what the lifetime bounds on the Interface are actually saying.
I tried moving the problem to the place where I use my struct by modifying it to look like this:
struct StructInWhichToStoreMyInteface<'a, T>
where
T: for<'b> Trait<'b>,
{
interface: Interface<'a, T>,
}
and it successfully removes the error, but now I cant even create this struct anymore, even when using 'static
lifetimes:
static S: StructInWhichToStoreMyInteface::<'static, Struct<'static>> = /* ... */;
So my second question would be, how can something with a static lifetime not be general enough to satisfy the lifetime bound?