@@ -7,13 +7,29 @@ LL | #![feature(precise_capturing)]
77 = note: see issue #123432 <https://github.com/rust-lang/rust/issues/123432> for more information
88 = note: `#[warn(incomplete_features)]` on by default
99
10- error: `impl Trait` must mention all type parameters in scope
11- --> $DIR/forgot-to-capture-lifetime.rs:4:15
10+ error: `impl Trait` captures lifetime parameter, but it is not mentioned in `use<...>` precise captures list
11+ --> $DIR/forgot-to-capture-lifetime.rs:4:58
1212 |
13- LL | fn type_param<T>() -> impl use<> Sized {}
14- | ^ ---------------- type parameter is implicitly captured by this `impl Trait`
13+ LL | fn lifetime_in_bounds<'a>(x: &'a ()) -> impl use<> Into<&'a ()> { x }
14+ | -- -----------------^^----
15+ | | |
16+ | | lifetime captured due to being mentioned in the bounds of the `impl Trait`
17+ | this lifetime parameter is captured
18+
19+ error[E0700]: hidden type for `impl Sized` captures lifetime that does not appear in bounds
20+ --> $DIR/forgot-to-capture-lifetime.rs:7:60
21+ |
22+ LL | fn lifetime_in_hidden<'a>(x: &'a ()) -> impl use<> Sized { x }
23+ | -- ---------------- ^
24+ | | |
25+ | | opaque type defined here
26+ | hidden type `&'a ()` captures the lifetime `'a` as defined here
27+ |
28+ help: to declare that `impl Sized` captures `'a`, you can add an explicit `'a` lifetime bound
1529 |
16- = note: currently, all type parameters are required to be mentioned in the precise captures list
30+ LL | fn lifetime_in_hidden<'a>(x: &'a ()) -> impl use<> Sized + 'a { x }
31+ | ++++
1732
18- error: aborting due to 1 previous error ; 1 warning emitted
33+ error: aborting due to 2 previous errors ; 1 warning emitted
1934
35+ For more information about this error, try `rustc --explain E0700`.
0 commit comments