|
| 1 | +error: `use<...>` precise capturing syntax is currently not allowed in return-position `impl Trait` in traits |
| 2 | + --> $DIR/rpitit.rs:11:36 |
| 3 | + | |
| 4 | +LL | fn hello() -> impl PartialEq + use<Self>; |
| 5 | + | ^^^^^^^^^ |
| 6 | + | |
| 7 | + = note: currently, return-position `impl Trait` in traits and trait implementations capture all lifetimes in scope |
| 8 | + |
| 9 | +error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list |
| 10 | + --> $DIR/rpitit.rs:11:19 |
| 11 | + | |
| 12 | +LL | trait Foo<'a> { |
| 13 | + | -- this lifetime parameter is captured |
| 14 | +LL | fn hello() -> impl PartialEq + use<Self>; |
| 15 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime captured due to being mentioned in the bounds of the `impl Trait` |
| 16 | + |
| 17 | +error: lifetime may not live long enough |
| 18 | + --> $DIR/rpitit.rs:15:5 |
| 19 | + | |
| 20 | +LL | fn test<'a, 'b, T: for<'r> Foo<'r>>() { |
| 21 | + | -- -- lifetime `'b` defined here |
| 22 | + | | |
| 23 | + | lifetime `'a` defined here |
| 24 | +LL | / PartialEq::eq( |
| 25 | +LL | | &<T as Foo<'a>>::hello(), |
| 26 | +LL | | &<T as Foo<'b>>::hello(), |
| 27 | +LL | | ); |
| 28 | + | |_____^ argument requires that `'a` must outlive `'b` |
| 29 | + | |
| 30 | + = help: consider adding the following bound: `'a: 'b` |
| 31 | + |
| 32 | +error: lifetime may not live long enough |
| 33 | + --> $DIR/rpitit.rs:15:5 |
| 34 | + | |
| 35 | +LL | fn test<'a, 'b, T: for<'r> Foo<'r>>() { |
| 36 | + | -- -- lifetime `'b` defined here |
| 37 | + | | |
| 38 | + | lifetime `'a` defined here |
| 39 | +LL | / PartialEq::eq( |
| 40 | +LL | | &<T as Foo<'a>>::hello(), |
| 41 | +LL | | &<T as Foo<'b>>::hello(), |
| 42 | +LL | | ); |
| 43 | + | |_____^ argument requires that `'b` must outlive `'a` |
| 44 | + | |
| 45 | + = help: consider adding the following bound: `'b: 'a` |
| 46 | + |
| 47 | +help: `'a` and `'b` must be the same: replace one with the other |
| 48 | + |
| 49 | +error: aborting due to 4 previous errors |
| 50 | + |
0 commit comments