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