2022-07-26 01:19:58 -05:00
error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds
2022-02-14 10:10:22 -06:00
--> $DIR/static-return-lifetime-infered.rs:7:9
2021-09-23 10:21:01 -05:00
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
2022-06-27 00:45:35 -05:00
| ----- hidden type `Map<std::slice::Iter<'_, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:7:27: 7:30]>` captures the anonymous lifetime defined here
2022-02-14 10:10:22 -06:00
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2021-09-23 10:21:01 -05:00
|
2022-10-22 16:38:05 -05:00
help: to declare that `impl Iterator<Item = u32>` captures `'_`, you can add an explicit `'_` lifetime bound
2021-09-23 10:21:01 -05:00
|
2021-09-25 06:49:14 -05:00
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ++++
2018-06-08 01:07:46 -05:00
2022-07-26 01:19:58 -05:00
error[E0700]: hidden type for `impl Iterator<Item = u32>` captures lifetime that does not appear in bounds
2022-12-16 16:47:24 -06:00
--> $DIR/static-return-lifetime-infered.rs:11:9
2020-06-01 19:51:12 -05:00
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
2022-12-16 16:47:24 -06:00
| -- hidden type `Map<std::slice::Iter<'a, (u32, u32)>, [closure@$DIR/static-return-lifetime-infered.rs:11:27: 11:30]>` captures the lifetime `'a` as defined here
2022-02-14 10:10:22 -06:00
LL | self.x.iter().map(|a| a.0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2018-06-08 01:07:46 -05:00
|
2022-10-22 16:38:05 -05:00
help: to declare that `impl Iterator<Item = u32>` captures `'a`, you can add an explicit `'a` lifetime bound
2021-09-23 10:21:01 -05:00
|
2021-09-25 06:49:14 -05:00
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> + 'a {
| ++++
2018-06-08 01:07:46 -05:00
2022-12-16 16:47:24 -06:00
error: aborting due to 2 previous errors
2018-06-08 01:07:46 -05:00
2021-09-23 10:21:01 -05:00
For more information about this error, try `rustc --explain E0700`.