18 lines
860 B
Plaintext
18 lines
860 B
Plaintext
error[E0759]: `items` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
|
|
--> $DIR/dyn-trait-underscore.rs:8:20
|
|
|
|
|
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
|
|
| ---- this data with an anonymous lifetime `'_`...
|
|
LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
|
|
LL | Box::new(items.iter())
|
|
| ---------------^^^^--- ...is captured and required to live as long as `'static` here
|
|
|
|
|
help: to declare that the trait object captures data from argument `items`, you can add an explicit `'_` lifetime bound
|
|
|
|
|
LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {
|
|
| ^^^^
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0759`.
|