]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/region-escape-via-bound.stderr
Remove in-band lifetimes
[rust.git] / src / test / ui / impl-trait / region-escape-via-bound.stderr
1 error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
2   --> $DIR/region-escape-via-bound.rs:14:37
3    |
4 LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y>
5    |        --                           ^^^^^^^^^^^^^^
6    |        |
7    |        hidden type `Cell<&'x u32>` captures the lifetime `'x` as defined here
8    |
9 help: to declare that the `impl Trait` captures `'x`, you can add an explicit `'x` lifetime bound
10    |
11 LL | fn foo<'x, 'y>(x: Cell<&'x u32>) -> impl Trait<'y> + 'x
12    |                                                    ++++
13
14 error: aborting due to previous error
15
16 For more information about this error, try `rustc --explain E0700`.