1 // When WF checking the hidden type in the ParamEnv of the opaque type,
2 // one complication arises when the hidden type is a closure/generator:
3 // the "parent_substs" of the type may reference lifetime parameters
4 // not present in the opaque type.
5 // These region parameters are not really useful in this check.
6 // So here we ignore them and replace them with fresh region variables.
10 #![feature(type_alias_impl_trait)]
15 // Hidden type = Closure['_#0r]
16 type Opaque = impl Sized;
18 fn define<'a: 'a>() -> Opaque {
23 // the region vars cannot both be equal to `'static` or `'empty`
27 // Hidden type = Closure['a, '_#0r, '_#1r]
28 // Constraints = [('_#0r: 'a), ('a: '_#1r)]
34 fn define<'a, 'x, 'y>() -> Opaque<'a>
44 // the region var cannot be equal to `'a` or `'b`
48 // Hidden type = Closure['a, 'b, '_#0r]
49 // Constraints = [('_#0r: 'a), ('_#0r: 'b)]
52 (&'a (), &'b ()): Trait,
53 = impl Sized + 'a + 'b;
55 fn define<'a, 'b, 'x>() -> Opaque<'a, 'b>
57 (&'a (), &'b ()): Trait,