2020-04-07 21:57:26 +00:00
|
|
|
error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function
|
2022-11-18 21:56:22 +00:00
|
|
|
--> $DIR/async-borrowck-escaping-block-error.rs:6:14
|
2019-10-06 13:57:23 +00:00
|
|
|
|
|
|
|
|
LL | Box::new(async { x } )
|
2022-11-18 21:56:22 +00:00
|
|
|
| ^^^^^^^^-^^
|
|
|
|
| | |
|
|
|
|
| | `x` is borrowed here
|
|
|
|
| may outlive borrowed value `x`
|
2019-10-06 13:57:23 +00:00
|
|
|
|
|
2020-04-07 21:57:26 +00:00
|
|
|
note: async block is returned here
|
2022-02-14 16:10:22 +00:00
|
|
|
--> $DIR/async-borrowck-escaping-block-error.rs:6:5
|
2019-10-06 13:57:23 +00:00
|
|
|
|
|
2022-02-14 16:10:22 +00:00
|
|
|
LL | Box::new(async { x } )
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
2019-10-10 14:20:57 +00:00
|
|
|
help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
2019-10-06 13:57:23 +00:00
|
|
|
|
|
|
|
|
LL | Box::new(async move { x } )
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++
|
2019-10-06 13:57:23 +00:00
|
|
|
|
2020-04-07 21:57:26 +00:00
|
|
|
error[E0373]: async block may outlive the current function, but it borrows `x`, which is owned by the current function
|
2022-11-18 21:56:22 +00:00
|
|
|
--> $DIR/async-borrowck-escaping-block-error.rs:11:5
|
2020-04-07 21:57:26 +00:00
|
|
|
|
|
|
|
|
LL | async { *x }
|
2022-11-18 21:56:22 +00:00
|
|
|
| ^^^^^^^^--^^
|
|
|
|
| | |
|
|
|
|
| | `x` is borrowed here
|
|
|
|
| may outlive borrowed value `x`
|
2020-04-07 21:57:26 +00:00
|
|
|
|
|
|
|
|
note: async block is returned here
|
|
|
|
--> $DIR/async-borrowck-escaping-block-error.rs:11:5
|
|
|
|
|
|
|
|
|
LL | async { *x }
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
help: to force the async block to take ownership of `x` (and any other referenced variables), use the `move` keyword
|
|
|
|
|
|
|
|
|
LL | async move { *x }
|
2021-06-22 02:07:19 +00:00
|
|
|
| ++++
|
2020-04-07 21:57:26 +00:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
2019-10-06 13:57:23 +00:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0373`.
|