| error[E0759]: cannot infer an appropriate lifetime |
| --> $DIR/static-return-lifetime-infered.rs:7:16 |
| | |
| LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> { |
| | ----- this data with an anonymous lifetime `'_`... |
| LL | self.x.iter().map(|a| a.0) |
| | ------ ^^^^ |
| | | |
| | ...is captured here... |
| | |
| note: ...and is required to live as long as `'static` here |
| --> $DIR/static-return-lifetime-infered.rs:6:35 |
| | |
| LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> { |
| | ^^^^^^^^^^^^^^^^^^^^^^^ |
| help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound |
| | |
| LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ { |
| | ^^^^ |
| |
| error[E0759]: cannot infer an appropriate lifetime |
| --> $DIR/static-return-lifetime-infered.rs:11:16 |
| | |
| LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> { |
| | -------- this data with lifetime `'a`... |
| LL | self.x.iter().map(|a| a.0) |
| | ------ ^^^^ |
| | | |
| | ...is captured here... |
| | |
| note: ...and is required to live as long as `'static` here |
| --> $DIR/static-return-lifetime-infered.rs:10:37 |
| | |
| LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> { |
| | ^^^^^^^^^^^^^^^^^^^^^^^ |
| help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound |
| | |
| LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a { |
| | ^^^^ |
| |
| error: aborting due to 2 previous errors |
| |
| For more information about this error, try `rustc --explain E0759`. |