//check-pass trait Yokeable<'a>: 'static { type Output: 'a; } trait IsCovariant<'a> {} struct Yoke Yokeable<'a>> { data: Y, } impl Yokeable<'a>> Yoke { fn project Yokeable<'a>>(&self, _f: for<'a> fn(>::Output, &'a ()) -> >::Output) -> Yoke { unimplemented!() } } fn _upcast(x: Yoke) -> Yoke + 'static>> where Y: for<'a> Yokeable<'a>, for<'a> >::Output: IsCovariant<'a> { x.project(|data, _| { Box::new(data) }) } impl<'a> Yokeable<'a> for Box + 'static> { type Output = Box + 'a>; } fn main() {}