It seems like it's not possible to implement Drop for types that have higher ranked trait bounds on their type arguments.
trait WithLifetime<'a> {
}
struct Foo<A: for<'a> WithLifetime<'a>> {
a: A,
}
impl<A: for<'a> WithLifetime<'a>> Drop for Foo<A> {
fn drop(&mut self) {}
}
This gives the error "The requirement for<'a> A: WithLifetime<'a> is added only by the Drop impl" which is obviously untrue. Removing that bound from the Drop impl gives the error "the trait bound for<'a> A: WithLifetime<'a> is not satisfied" as it should.
It seems like it's not possible to implement
Dropfor types that have higher ranked trait bounds on their type arguments.This gives the error "The requirement
for<'a> A: WithLifetime<'a>is added only by the Drop impl" which is obviously untrue. Removing that bound from theDropimpl gives the error "the trait boundfor<'a> A: WithLifetime<'a>is not satisfied" as it should.