use std::future::Future; use std::pin::Pin; trait MyTrait { fn foo<'a, 'b>(&'a self, x: &'b i32) -> impl Future; } trait ErasedMyTrait { fn foo<'life0, 'life1, 'dynosaur>(&'life0 self, x: &'life1 i32) -> Pin + 'dynosaur>> where 'life0: 'dynosaur, 'life1: 'dynosaur; } struct DynMyTrait { ptr: T, } impl MyTrait for DynMyTrait { fn foo<'a, 'b>(&'a self, x: &'b i32) -> impl Future { self.ptr.foo(x) //~^ ERROR hidden type for `impl Future` captures lifetime that does not appear in bounds } } fn main() {}