2022-10-01 12:19:31 +02:00
|
|
|
error[E0597]: `a` does not live long enough
|
2023-05-07 18:38:52 +00:00
|
|
|
--> $DIR/borrowing.rs:9:33
|
2022-10-01 12:19:31 +02:00
|
|
|
|
|
2023-10-24 19:16:15 +02:00
|
|
|
LL | let _b = {
|
|
|
|
| -- borrow later stored here
|
|
|
|
LL | let a = 3;
|
2022-10-01 12:19:31 +02:00
|
|
|
LL | Pin::new(&mut || yield &a).resume(())
|
2023-10-24 19:16:15 +02:00
|
|
|
| -- ^ borrowed value does not live long enough
|
|
|
|
| |
|
2023-10-19 21:46:28 +00:00
|
|
|
| value captured here by coroutine
|
2022-10-01 12:19:31 +02:00
|
|
|
LL |
|
|
|
|
LL | };
|
2023-10-24 19:16:15 +02:00
|
|
|
| - `a` dropped here while still borrowed
|
2022-10-01 12:19:31 +02:00
|
|
|
|
|
|
|
error[E0597]: `a` does not live long enough
|
2023-05-07 18:38:52 +00:00
|
|
|
--> $DIR/borrowing.rs:16:20
|
2022-10-01 12:19:31 +02:00
|
|
|
|
|
|
|
|
LL | let _b = {
|
|
|
|
| -- borrow later stored here
|
|
|
|
LL | let a = 3;
|
|
|
|
LL | || {
|
2023-10-19 21:46:28 +00:00
|
|
|
| -- value captured here by coroutine
|
2022-10-01 12:19:31 +02:00
|
|
|
LL | yield &a
|
|
|
|
| ^ borrowed value does not live long enough
|
|
|
|
...
|
|
|
|
LL | };
|
|
|
|
| - `a` dropped here while still borrowed
|
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|