fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: lifetime may not live long enough 2 --> $DIR/trait-object-nested-in-impl-trait.rs:28:9 3 | 4LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> { 5 | - let's call the lifetime of this reference `'1` 6LL | / Iter { 7LL | | 8LL | | current: None, 9LL | | remaining: self.0.iter(), 10LL | | } 11 | |_________^ returning this value requires that `'1` must outlive `'static` 12 | 13help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'_` lifetime bound 14 | 15LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ { 16 | ++++ 17help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound 18 | 19LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> { 20 | ++++ 21 22error: lifetime may not live long enough 23 --> $DIR/trait-object-nested-in-impl-trait.rs:40:9 24 | 25LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo>> + '_ { 26 | - let's call the lifetime of this reference `'1` 27LL | / Iter { 28LL | | 29LL | | current: None, 30LL | | remaining: self.0.iter(), 31LL | | } 32 | |_________^ returning this value requires that `'1` must outlive `'static` 33 | 34help: to declare that the trait object captures data from argument `self`, you can add an explicit `'_` lifetime bound 35 | 36LL | fn iter(&self) -> impl Iterator<Item = Box<dyn Foo + '_>> + '_ { 37 | ++++ 38 39error: lifetime may not live long enough 40 --> $DIR/trait-object-nested-in-impl-trait.rs:52:9 41 | 42LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a { 43 | -- lifetime `'a` defined here 44LL | / Iter { 45LL | | 46LL | | current: None, 47LL | | remaining: self.0.iter(), 48LL | | } 49 | |_________^ returning this value requires that `'a` must outlive `'static` 50 | 51help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound 52 | 53LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> + 'a { 54 | ++++ 55 56error: lifetime may not live long enough 57 --> $DIR/trait-object-nested-in-impl-trait.rs:64:9 58 | 59LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> { 60 | -- lifetime `'a` defined here 61LL | / Iter { 62LL | | 63LL | | current: None, 64LL | | remaining: self.0.iter(), 65LL | | } 66 | |_________^ returning this value requires that `'a` must outlive `'static` 67 | 68help: to declare that `impl Iterator<Item = Box<(dyn Foo + 'static)>>` captures data from argument `self`, you can add an explicit `'a` lifetime bound 69 | 70LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo>> + 'a { 71 | ++++ 72help: to declare that the trait object captures data from argument `self`, you can add an explicit `'a` lifetime bound 73 | 74LL | fn iter<'a>(&'a self) -> impl Iterator<Item = Box<dyn Foo + 'a>> { 75 | ++++ 76 77error: aborting due to 4 previous errors 78