1 error: lifetime may not live long enough
2 --> $DIR/trait-object-nested-in-impl-trait.rs:28:9
4 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
5 | - let's call the lifetime of this reference `'1`
9 LL | | remaining: self.0.iter(),
11 | |_________^ returning this value requires that `'1` must outlive `'static`
13 help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'_` lifetime bound
15 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
17 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
19 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> {
22 error: lifetime may not live long enough
23 --> $DIR/trait-object-nested-in-impl-trait.rs:40:9
25 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
26 | - let's call the lifetime of this reference `'1`
30 LL | | remaining: self.0.iter(),
32 | |_________^ returning this value requires that `'1` must outlive `'static`
34 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
36 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ {
39 error: lifetime may not live long enough
40 --> $DIR/trait-object-nested-in-impl-trait.rs:52:9
42 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
43 | -- lifetime `'a` defined here
47 LL | | remaining: self.0.iter(),
49 | |_________^ returning this value requires that `'a` must outlive `'static`
51 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
53 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a {
56 error: lifetime may not live long enough
57 --> $DIR/trait-object-nested-in-impl-trait.rs:64:9
59 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
60 | -- lifetime `'a` defined here
64 LL | | remaining: self.0.iter(),
66 | |_________^ returning this value requires that `'a` must outlive `'static`
68 help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'a` lifetime bound
70 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
72 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
74 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> {
77 error: aborting due to 4 previous errors