1 error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
2 --> $DIR/dyn-trait-underscore.rs:18:20
4 LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
7 note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 16:1...
8 --> $DIR/dyn-trait-underscore.rs:16:1
10 LL | / fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
11 LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
12 LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
15 note: ...so that reference does not outlive borrowed content
16 --> $DIR/dyn-trait-underscore.rs:18:14
18 LL | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
20 = note: but, the lifetime must be valid for the static lifetime...
21 = note: ...so that the expression is assignable:
22 expected std::boxed::Box<(dyn std::iter::Iterator<Item=&T> + 'static)>
23 found std::boxed::Box<dyn std::iter::Iterator<Item=&T>>
25 error: aborting due to previous error
27 For more information about this error, try `rustc --explain E0495`.