1 // Check that the `'_` in `dyn Trait + '_` acts like ordinary elision,
2 // and not like an object lifetime default.
6 fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
7 // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
8 Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
11 fn b<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {
12 Box::new(items.iter()) // OK, equivalent to c
15 fn c<'a, T>(items: &'a [T]) -> Box<dyn Iterator<Item=&'a T> + 'a> {
16 Box::new(items.iter()) // OK, equivalent to b