]>
Commit | Line | Data |
---|---|---|
0531ce1d | 1 | error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements |
0731742a | 2 | --> $DIR/dyn-trait-underscore.rs:8:20 |
0531ce1d | 3 | | |
532ac7d7 | 4 | LL | Box::new(items.iter()) |
0531ce1d XL |
5 | | ^^^^ |
6 | | | |
0731742a XL |
7 | note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the function body at 6:1... |
8 | --> $DIR/dyn-trait-underscore.rs:6:1 | |
0531ce1d XL |
9 | | |
10 | LL | / fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> { | |
11 | LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static` | |
532ac7d7 | 12 | LL | | Box::new(items.iter()) |
0531ce1d XL |
13 | LL | | } |
14 | | |_^ | |
15 | note: ...so that reference does not outlive borrowed content | |
0731742a | 16 | --> $DIR/dyn-trait-underscore.rs:8:14 |
0531ce1d | 17 | | |
532ac7d7 | 18 | LL | Box::new(items.iter()) |
0531ce1d XL |
19 | | ^^^^^ |
20 | = note: but, the lifetime must be valid for the static lifetime... | |
60c5eb7d XL |
21 | note: ...so that the expression is assignable |
22 | --> $DIR/dyn-trait-underscore.rs:8:5 | |
23 | | | |
24 | LL | Box::new(items.iter()) | |
25 | | ^^^^^^^^^^^^^^^^^^^^^^ | |
26 | = note: expected `std::boxed::Box<(dyn std::iter::Iterator<Item = &T> + 'static)>` | |
27 | found `std::boxed::Box<dyn std::iter::Iterator<Item = &T>>` | |
0531ce1d XL |
28 | |
29 | error: aborting due to previous error | |
30 | ||
e74abb32 | 31 | For more information about this error, try `rustc --explain E0495`. |