]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr
Rollup merge of #107108 - sulami:issue-83968-doc-alias-typo-suggestions, r=compiler...
[rust.git] / tests / ui / async-await / multiple-lifetimes / ret-impl-trait-one.stderr
1 error: lifetime may not live long enough
2   --> $DIR/ret-impl-trait-one.rs:10:85
3    |
4 LL |   async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
5    |  ________________________________--__--_______________________________________________^
6    | |                                |   |
7    | |                                |   lifetime `'b` defined here
8    | |                                lifetime `'a` defined here
9 LL | |
10 LL | |     (a, b)
11 LL | | }
12    | |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
13    |
14    = help: consider adding the following bound: `'a: 'b`
15
16 error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not appear in bounds
17   --> $DIR/ret-impl-trait-one.rs:16:80
18    |
19 LL |   async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
20    |  ____________________________________--__________________________________________^
21    | |                                    |
22    | |                                    hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
23 LL | |
24 LL | |     (a, b)
25 LL | | }
26    | |_^
27    |
28 help: to declare that `impl Trait<'a>` captures `'b`, you can add an explicit `'b` lifetime bound
29    |
30 LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
31    |                                                                                ++++
32
33 error: aborting due to 2 previous errors
34
35 For more information about this error, try `rustc --explain E0700`.