]> git.proxmox.com Git - rustc.git/blob - tests/ui/underscore-lifetime/dyn-trait-underscore.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / underscore-lifetime / dyn-trait-underscore.stderr
1 error: lifetime may not live long enough
2 --> $DIR/dyn-trait-underscore.rs:8:5
3 |
4 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T>> {
5 | - let's call the lifetime of this reference `'1`
6 LL | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
7 LL | Box::new(items.iter())
8 | ^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
9 |
10 help: to declare that the trait object captures data from argument `items`, you can add an explicit `'_` lifetime bound
11 |
12 LL | fn a<T>(items: &[T]) -> Box<dyn Iterator<Item=&T> + '_> {
13 | ++++
14
15 error: aborting due to previous error
16