1 // Test the interaction between rested RPIT and HRTB.
11 // Alternative version of `Foo` whose impl uses `'a`.
16 impl<'a> Bar<'a> for () {
22 impl Qux<'_> for () {}
24 // This is not supported.
25 fn one_hrtb_outlives() -> impl for<'a> Foo<'a, Assoc = impl Sized + 'a> {}
26 //~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
28 // This is not supported.
29 fn one_hrtb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl Qux<'a>> {}
30 //~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
32 fn one_hrtb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'a> {}
33 //~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
35 fn one_hrtb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl Qux<'a>> {}
36 //~^ ERROR higher kinded lifetime bounds on nested opaque types are not supported yet
39 fn one_hrtb_mention_fn_trait_param<'b>() -> impl for<'a> Foo<'a, Assoc = impl Qux<'b>> {}
42 fn one_hrtb_mention_fn_outlives<'b>() -> impl for<'a> Foo<'a, Assoc = impl Sized + 'b> {}
45 fn one_hrtb_mention_fn_trait_param_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Qux<'b>> {}
48 fn one_hrtb_mention_fn_outlives_uses<'b>() -> impl for<'a> Bar<'a, Assoc = impl Sized + 'b> {}
51 fn two_htrb_trait_param() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Qux<'b>> {}
53 // `'b` is not in scope for the outlives bound.
54 fn two_htrb_outlives() -> impl for<'a> Foo<'a, Assoc = impl for<'b> Sized + 'b> {}
55 //~^ ERROR use of undeclared lifetime name `'b` [E0261]
58 fn two_htrb_trait_param_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Qux<'b>> {}
60 // `'b` is not in scope for the outlives bound.
61 fn two_htrb_outlives_uses() -> impl for<'a> Bar<'a, Assoc = impl for<'b> Sized + 'b> {}
62 //~^ ERROR use of undeclared lifetime name `'b` [E0261]