mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
37 lines
1.4 KiB
Plaintext
37 lines
1.4 KiB
Plaintext
error: lifetime may not live long enough
|
|
--> $DIR/check-resume-ty-lifetimes-2.rs:11:16
|
|
|
|
|
LL | fn bad1<'short, 'long: 'short>() -> impl Coroutine<Covariant<'short>> {
|
|
| ------ ----- lifetime `'long` defined here
|
|
| |
|
|
| lifetime `'short` defined here
|
|
LL | |_: Covariant<'short>| {
|
|
LL | let a: Covariant<'long> = yield ();
|
|
| ^^^^^^^^^^^^^^^^ type annotation requires that `'short` must outlive `'long`
|
|
|
|
|
= help: consider adding the following bound: `'short: 'long`
|
|
help: consider adding 'move' keyword before the nested closure
|
|
|
|
|
LL | move |_: Covariant<'short>| {
|
|
| ++++
|
|
|
|
error: lifetime may not live long enough
|
|
--> $DIR/check-resume-ty-lifetimes-2.rs:18:40
|
|
|
|
|
LL | fn bad2<'short, 'long: 'short>() -> impl Coroutine<Contravariant<'long>> {
|
|
| ------ ----- lifetime `'long` defined here
|
|
| |
|
|
| lifetime `'short` defined here
|
|
LL | |_: Contravariant<'long>| {
|
|
LL | let a: Contravariant<'short> = yield ();
|
|
| ^^^^^^^^ yielding this value requires that `'short` must outlive `'long`
|
|
|
|
|
= help: consider adding the following bound: `'short: 'long`
|
|
help: consider adding 'move' keyword before the nested closure
|
|
|
|
|
LL | move |_: Contravariant<'long>| {
|
|
| ++++
|
|
|
|
error: aborting due to 2 previous errors
|
|
|