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