// run-pass //! Regression test for #34426, regarding HRTB in drop impls // All of this Drop impls should compile. pub trait Lifetime<'a> {} impl<'a> Lifetime<'a> for i32 {} #[allow(dead_code)] struct Foo where for<'a> L: Lifetime<'a>, { l: L, } impl Drop for Foo where for<'a> L: Lifetime<'a>, { fn drop(&mut self) {} } #[allow(dead_code)] struct Foo2 where for<'a> L: Lifetime<'a>, { l: L, } impl Lifetime<'a>> Drop for Foo2 where for<'x> T: Lifetime<'x>, { fn drop(&mut self) {} } pub trait Lifetime2<'a, 'b> {} impl<'a, 'b> Lifetime2<'a, 'b> for i32 {} #[allow(dead_code)] struct Bar where for<'a, 'b> L: Lifetime2<'a, 'b>, { l: L, } impl Drop for Bar where for<'a, 'b> L: Lifetime2<'a, 'b>, { fn drop(&mut self) {} } #[allow(dead_code)] struct FnHolder Fn(&'a T, dyn for<'b> Lifetime2<'a, 'b>) -> u8>(T); impl Fn(&'a T, dyn for<'b> Lifetime2<'a, 'b>) -> u8> Drop for FnHolder { fn drop(&mut self) {} } fn main() { let _foo = Foo { l: 0 }; let _bar = Bar { l: 0 }; }