mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 10:45:18 +00:00
32 lines
1.3 KiB
Plaintext
32 lines
1.3 KiB
Plaintext
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`.
|