fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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