fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.7 KiB36 linesraw
1error: lifetime may not live long enough
2  --> $DIR/ret-impl-trait-one.rs:10:85
3   |
4LL |   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
9LL | |
10LL | |     (a, b)
11LL | | }
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
16error[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   |
19LL |   async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
20   |  ____________________________________--___________________________--------------_^
21   | |                                    |                            |
22   | |                                    |                            opaque type defined here
23   | |                                    hidden type `(&'a u8, &'b u8)` captures the lifetime `'b` as defined here
24LL | |
25LL | |     (a, b)
26LL | | }
27   | |_^
28   |
29help: to declare that `impl Trait<'a>` captures `'b`, you can add an explicit `'b` lifetime bound
30   |
31LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
32   |                                                                                ++++
33
34error: aborting due to 2 previous errors
35
36For more information about this error, try `rustc --explain E0700`.