Do note that in practice some your types implementing Foo might come with a comparable restriction though. E.g. if you implement impl<T> Foo<T> for SomeStruct<T>, then SomeStruct<T> can only be used for impl Foo<T> + 'a if the bound SomeStruct<T>: 'a and hence T: 'a is implemented.
A similar thing could apply to trait objects. E.g. if you have a generic impl lifting Foo<T> implementations from S: ?Sized to Box<S>, and then try to pass Box<dyn Foo<T>>[1] for the impl Foo<T> + 'a, then a Box<dyn Foo<T>>: 'a requirement would also imply a T: 'a requirement.
E.g. if you implement impl<T> Foo<T> for SomeStruct<T> , then SomeStruct<T> can only be used for impl Foo<T> + 'a if the bound SomeStruct<T>: 'a and hence T: 'a is implemented
Can you explain this case a bit more? This applies even while SomeStruct does not store a T?
Can I do something to prevent the constraint from applying to T if the struct doesn't store one?
Why must the lifetime constraint apply to T if SomeStruct only contains a fn(T)?
If no T will be dropped, it seems like the constraint is applied for no reason?
I am using closures and function pointers quite a bit so I am trying to understand the relationship between the lifetime constraints and generics in that case.
For a concrete example, if fn(Cell<&'a str>) was 'static, you could cast it to dyn Any and then downcast it to... what? It can't soundly be fn(Cell<&'b str>) for a different lifetime 'b, but there isn't a finite set of lifetimes.