]>
Commit | Line | Data |
---|---|---|
3dfed10e | 1 | error[E0759]: `items` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement |
0731742a | 2 | --> $DIR/dyn-trait-underscore.rs:8:20 |
0531ce1d | 3 | | |
f9f354fc | 4 | LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> { |
f035d41b | 5 | | ---- this data with an anonymous lifetime `'_`... |
f9f354fc | 6 | LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` |
532ac7d7 | 7 | LL | Box::new(items.iter()) |
f035d41b | 8 | | ---------------^^^^--- ...is captured and required to live as long as `'static` here |
0531ce1d | 9 | | |
f035d41b | 10 | help: to declare that the trait object captures data from argument `items`, you can add an explicit `'_` lifetime bound |
0531ce1d | 11 | | |
f9f354fc | 12 | LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> { |
94222f64 | 13 | | ++++ |
0531ce1d XL |
14 | |
15 | error: aborting due to previous error | |
16 | ||
f035d41b | 17 | For more information about this error, try `rustc --explain E0759`. |