summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/multiple-lifetimes/ret-impl-trait-one.stderr
blob: 5ae1d78a92b785509032aaace5b39dd2431d43db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
error: lifetime may not live long enough
  --> $DIR/ret-impl-trait-one.rs:10:85
   |
LL |   async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
   |  ________________________________--__--_______________________________________________^
   | |                                |   |
   | |                                |   lifetime `'b` defined here
   | |                                lifetime `'a` defined here
LL | |
LL | |     (a, b)
LL | | }
   | |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
   |
   = help: consider adding the following bound: `'a: 'b`

error[E0700]: hidden type for `impl Trait<'a>` captures lifetime that does not appear in bounds
  --> $DIR/ret-impl-trait-one.rs:16:80
   |
LL |   async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
   |  ____________________________________--___________________________--------------_^
   | |                                    |                            |
   | |                                    |                            opaque type defined here
   | |                                    hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
LL | |
LL | |     (a, b)
LL | | }
   | |_^
   |
help: to declare that `impl Trait<'a>` captures `'b`, you can add an explicit `'b` lifetime bound
   |
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
   |                                                                                ++++

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0700`.