1 error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
2 --> $DIR/trait-object-nested-in-impl-trait.rs:30:31
4 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
5 | ----- this data with an anonymous lifetime `'_`...
7 LL | remaining: self.0.iter(),
10 | ...is captured here...
12 note: ...and is required to live as long as `'static` here
13 --> $DIR/trait-object-nested-in-impl-trait.rs:27:23
15 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> {
16 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'_` lifetime bound
19 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
21 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
23 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> {
26 error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
27 --> $DIR/trait-object-nested-in-impl-trait.rs:41:31
29 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
30 | ----- this data with an anonymous lifetime `'_`...
32 LL | remaining: self.0.iter(),
35 | ...is captured here...
37 note: ...and is required to live as long as `'static` here
38 --> $DIR/trait-object-nested-in-impl-trait.rs:38:23
40 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ {
41 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound
44 LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ {
47 error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
48 --> $DIR/trait-object-nested-in-impl-trait.rs:52:31
50 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
51 | -------- this data with lifetime `'a`...
53 LL | remaining: self.0.iter(),
56 | ...is captured here...
58 note: ...and is required to live as long as `'static` here
59 --> $DIR/trait-object-nested-in-impl-trait.rs:49:30
61 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
62 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
65 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a {
68 error[E0759]: `self` has lifetime `'a` but it needs to satisfy a `'static` lifetime requirement
69 --> $DIR/trait-object-nested-in-impl-trait.rs:63:31
71 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
72 | -------- this data with lifetime `'a`...
74 LL | remaining: self.0.iter(),
77 | ...is captured here...
79 note: ...and is required to live as long as `'static` here
80 --> $DIR/trait-object-nested-in-impl-trait.rs:60:30
82 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> {
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 help: to declare that the `impl Trait` captures data from argument `self`, you can add an explicit `'a` lifetime bound
86 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a {
88 help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound
90 LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> {
93 error: aborting due to 4 previous errors
95 For more information about this error, try `rustc --explain E0759`.