]> git.proxmox.com Git - rustc.git/blame - src/test/ui/underscore-lifetime/dyn-trait-underscore.stderr
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / underscore-lifetime / dyn-trait-underscore.stderr
CommitLineData
0531ce1d 1error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
0731742a 2 --> $DIR/dyn-trait-underscore.rs:8:20
0531ce1d 3 |
532ac7d7 4LL | Box::new(items.iter())
0531ce1d
XL
5 | ^^^^
6 |
0731742a
XL
7note: 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 |
10LL | / fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
11LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
532ac7d7 12LL | | Box::new(items.iter())
0531ce1d
XL
13LL | | }
14 | |_^
15note: ...so that reference does not outlive borrowed content
0731742a 16 --> $DIR/dyn-trait-underscore.rs:8:14
0531ce1d 17 |
532ac7d7 18LL | Box::new(items.iter())
0531ce1d
XL
19 | ^^^^^
20 = note: but, the lifetime must be valid for the static lifetime...
60c5eb7d
XL
21note: ...so that the expression is assignable
22 --> $DIR/dyn-trait-underscore.rs:8:5
23 |
24LL | 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
29error: aborting due to previous error
30
e74abb32 31For more information about this error, try `rustc --explain E0495`.