error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
- --> $DIR/region-escape-via-bound.rs:18:5
+ --> $DIR/region-escape-via-bound.rs:14:37
|
-LL | where 'x: 'y
- | -- hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here
-LL | {
-LL | x
- | ^
+LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y>
+ | -- ^^^^^^^^^^^^^^
+ | |
+ | hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here
|
help: to declare that the `impl Trait` captures `'x`, you can add an explicit `'x` lifetime bound
|
-LL | fn foo(x: Cell<&'x u32>) -> impl Trait<'y> + 'x
- | ++++
+LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> + 'x
+ | ++++
error: aborting due to previous error