]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/static-return-lifetime-infered.nll.stderr
Rollup merge of #87346 - rylev:rename-force-warn, r=nikomatsakis
[rust.git] / src / test / ui / impl-trait / static-return-lifetime-infered.nll.stderr
1 error: lifetime may not live long enough
2   --> $DIR/static-return-lifetime-infered.rs:6:35
3    |
4 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
5    |                         -         ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
6    |                         |
7    |                         let's call the lifetime of this reference `'1`
8    |
9 help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a bound
10    |
11 LL |     fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
12    |                                                           ^^^^
13
14 error: lifetime may not live long enough
15   --> $DIR/static-return-lifetime-infered.rs:9:37
16    |
17 LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
18    |                    --               ^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
19    |                    |
20    |                    lifetime `'a` defined here
21    |
22    = help: consider replacing `'a` with `'static`
23 help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
24    |
25 LL |     fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
26    |                                                             ^^^^
27
28 error: aborting due to 2 previous errors
29