blob: da76ac1c474a3ee5ba3c43e86bba39c4ef78ff01 [file] [log] [blame]
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-fn.rs:13:5
|
LL | fn no_region<'a, T>(mut x: T) -> Box<dyn Anything + 'a>
| -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
...
LL | Box::new(x.next())
| ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | T: Iterator, <T as Iterator>::Item: 'a
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error[E0309]: the associated type `<T as Iterator>::Item` may not live long enough
--> $DIR/projection-no-regions-fn.rs:28:5
|
LL | fn wrong_region<'a, 'b, T>(mut x: T) -> Box<dyn Anything + 'a>
| -- the associated type `<T as Iterator>::Item` must be valid for the lifetime `'a` as defined here...
...
LL | Box::new(x.next())
| ^^^^^^^^^^^^^^^^^^ ...so that the type `<T as Iterator>::Item` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
LL | T: 'b + Iterator, <T as Iterator>::Item: 'a
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0309`.