Skip to content

Point at the right enclosing scope when using await in non-async fn #63509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 15, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
review comment: move test
  • Loading branch information
estebank committed Aug 13, 2019
commit 25d507f497885cd26f1dba8c8e8158c12d02bd6c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
async fn do_the_thing() -> u8 {
8
}

fn main() {
// #63398: point at the enclosing scope and not the previously seen closure
fn main() { //~ NOTE this is not `async`
let x = move || {};
let y = do_the_thing().await; //~ ERROR `await` is only allowed inside `async` functions
//~^ NOTE only allowed inside `async` functions and blocks
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/issue-63398.rs:10:13
--> $DIR/non-async-enclosing-span.rs:10:13
|
LL | fn main() {
| ---- this is not `async`
Expand Down