1 // If the hidden type is a closure, we require the "outlives" bounds that appear on the
2 // defining site to also appear on the opaque type.
4 // It's not clear if this is the desired behavior but at least
5 // it's consistent and has no back-compat risk.
9 #![feature(type_alias_impl_trait)]
12 // requires `'a: 'b` bound
14 type Opaque<'a, 'b> = impl Sized + 'a + 'b;
15 //~^ ERROR lifetime bound not satisfied
17 fn define<'a, 'b>() -> Opaque<'a, 'b>
25 // Same as the above but through indirection `'x`
27 type Opaque<'a, 'b> = impl Sized + 'a + 'b;
28 //~^ ERROR cannot infer an appropriate lifetime
30 fn define<'a, 'b, 'x>() -> Opaque<'a, 'b>
39 // fixed version of the above
41 type Opaque<'a: 'b, 'b> = impl Sized + 'a + 'b;
43 fn define<'a, 'b, 'x>() -> Opaque<'a, 'b>
52 // requires `T: 'static`
54 type Opaque<T> = impl Sized;
55 //~^ ERROR the parameter type `T` may not live long enough
57 fn define<T>() -> Opaque<T>