2020-06-09 15:57:33 -05:00
|
|
|
error: lifetime may not live long enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/trait-object-nested-in-impl-trait.rs:28:9
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
2021-09-23 10:21:01 -05:00
|
|
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
|
|
|
|
| - let's call the lifetime of this reference `'1`
|
|
|
|
LL | / Iter {
|
2022-05-22 00:36:12 -05:00
|
|
|
LL | |
|
2021-09-23 10:21:01 -05:00
|
|
|
LL | | current: None,
|
|
|
|
LL | | remaining: self.0.iter(),
|
|
|
|
LL | | }
|
|
|
|
| |_________^ returning this value requires that `'1` must outlive `'static`
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
2022-10-22 16:38:05 -05:00
|
|
|
help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'_` lifetime bound
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
|
2021-06-21 21:07:19 -05:00
|
|
|
| ++++
|
2022-04-24 09:44:09 -05:00
|
|
|
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
|
|
|
|
|
|
|
|
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> {
|
|
|
|
| ++++
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/trait-object-nested-in-impl-trait.rs:40:9
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
|
|
|
|
| - let's call the lifetime of this reference `'1`
|
|
|
|
LL | / Iter {
|
2022-05-22 00:36:12 -05:00
|
|
|
LL | |
|
2020-06-09 15:57:33 -05:00
|
|
|
LL | | current: None,
|
|
|
|
LL | | remaining: self.0.iter(),
|
|
|
|
LL | | }
|
|
|
|
| |_________^ returning this value requires that `'1` must outlive `'static`
|
2022-04-24 09:44:09 -05:00
|
|
|
|
|
|
|
|
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
|
|
|
|
|
|
|
|
|
LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ {
|
|
|
|
| ++++
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/trait-object-nested-in-impl-trait.rs:52:9
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
LL | / Iter {
|
2022-05-22 00:36:12 -05:00
|
|
|
LL | |
|
2020-06-09 15:57:33 -05:00
|
|
|
LL | | current: None,
|
|
|
|
LL | | remaining: self.0.iter(),
|
|
|
|
LL | | }
|
|
|
|
| |_________^ returning this value requires that `'a` must outlive `'static`
|
2022-04-24 09:44:09 -05:00
|
|
|
|
|
|
|
|
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
|
|
|
|
|
|
|
|
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a {
|
|
|
|
| ++++
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
error: lifetime may not live long enough
|
2022-04-01 12:13:25 -05:00
|
|
|
--> $DIR/trait-object-nested-in-impl-trait.rs:64:9
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
2021-09-23 10:21:01 -05:00
|
|
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
|
|
|
|
| -- lifetime `'a` defined here
|
|
|
|
LL | / Iter {
|
2022-05-22 00:36:12 -05:00
|
|
|
LL | |
|
2021-09-23 10:21:01 -05:00
|
|
|
LL | | current: None,
|
|
|
|
LL | | remaining: self.0.iter(),
|
|
|
|
LL | | }
|
|
|
|
| |_________^ returning this value requires that `'a` must outlive `'static`
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
2022-10-22 16:38:05 -05:00
|
|
|
help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'a` lifetime bound
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
|
2021-06-21 21:07:19 -05:00
|
|
|
| ++++
|
2022-04-24 09:44:09 -05:00
|
|
|
help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
|
|
|
|
|
|
|
|
|
LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> {
|
|
|
|
| ++++
|
2020-06-09 15:57:33 -05:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|