Closed
Description
The following code (Playground link)
#![feature(async_await)]
async fn do_the_thing() -> u8 {
8
}
fn main() {
let x = move || {};
let y = do_the_thing().await;
}
Emits the incorrect error:
Compiling playground v0.0.1 (/playground)
error[E0728]: `await` is only allowed inside `async` functions and blocks
--> src/main.rs:8:13
|
7 | let x = move || {};
| ------- this is not `async`
8 | let y = do_the_thing().await;
| ^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
error: aborting due to previous error
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
It should point to the block belonging to fn main
and not the closure from the line above the usage of await
.