1 error: cannot infer an appropriate lifetime
2 --> $DIR/static-return-lifetime-infered.rs:17:16
4 LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
5 | ----------------------- this return type evaluates to the `'static` lifetime...
6 LL | self.x.iter().map(|a| a.0)
9 | ...but this borrow...
11 note: ...can't outlive the anonymous lifetime #1 defined on the method body at 16:5
12 --> $DIR/static-return-lifetime-infered.rs:16:5
14 LL | / fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
15 LL | | self.x.iter().map(|a| a.0)
18 help: you can add a constraint to the return type to make it last less than `'static` and match the anonymous lifetime #1 defined on the method body at 16:5
20 LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 error: cannot infer an appropriate lifetime
24 --> $DIR/static-return-lifetime-infered.rs:21:16
26 LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
27 | ----------------------- this return type evaluates to the `'static` lifetime...
28 LL | self.x.iter().map(|a| a.0)
31 | ...but this borrow...
33 note: ...can't outlive the lifetime 'a as defined on the method body at 20:20
34 --> $DIR/static-return-lifetime-infered.rs:20:20
36 LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
38 help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the method body at 20:20
40 LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43 error: aborting due to 2 previous errors