-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Point at the right enclosing scope when using
await
in non-async fn
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// edition:2018 | ||
#![feature(async_await)] | ||
|
||
async fn do_the_thing() -> u8 { | ||
8 | ||
} | ||
|
||
fn main() { | ||
let x = move || {}; | ||
let y = do_the_thing().await; //~ ERROR `await` is only allowed inside `async` functions | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0728]: `await` is only allowed inside `async` functions and blocks | ||
--> $DIR/issue-63398.rs:10:13 | ||
| | ||
LL | fn main() { | ||
| ---- this is not `async` | ||
LL | let x = move || {}; | ||
LL | let y = do_the_thing().await; | ||
| ^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks | ||
|
||
error: aborting due to previous error | ||
|