]> git.lizzy.rs Git - rust.git/blob - src/test/ui/suggestions/impl-trait-missing-lifetime.stderr
Rollup merge of #99079 - compiler-errors:issue-99073, r=oli-obk
[rust.git] / src / test / ui / suggestions / impl-trait-missing-lifetime.stderr
1 error[E0106]: missing lifetime specifier
2   --> $DIR/impl-trait-missing-lifetime.rs:9:54
3    |
4 LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
5    |                                                      ^^ expected named lifetime parameter
6    |
7    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
8 help: consider using the `'static` lifetime
9    |
10 LL | fn g(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() }
11    |                                                      ~~~~~~~
12
13 error[E0106]: missing lifetime specifier
14   --> $DIR/impl-trait-missing-lifetime.rs:16:60
15    |
16 LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
17    |                                                            ^^ expected named lifetime parameter
18    |
19    = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
20 help: consider using the `'static` lifetime
21    |
22 LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'static ()> { x.next() }
23    |                                                            ~~~~~~~
24
25 error: lifetime may not live long enough
26   --> $DIR/impl-trait-missing-lifetime.rs:16:69
27    |
28 LL | async fn i(mut x: impl Iterator<Item = &'_ ()>) -> Option<&'_ ()> { x.next() }
29    |                                                    --------------   ^^^^^^^^ returning this value requires that `'1` must outlive `'static`
30    |                                                    |
31    |                                                    return type `impl Future<Output = Option<&'static ()>>` contains a lifetime `'1`
32
33 error: aborting due to 3 previous errors
34
35 For more information about this error, try `rustc --explain E0106`.