-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc3800f
commit 70b092e
Showing
3 changed files
with
60 additions
and
9 deletions.
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,9 @@ | ||
//@ edition:2021 | ||
|
||
fn main() { | ||
async { | ||
use std::ops::Add; | ||
let _ = 1.add(3); | ||
}.await | ||
//~^ ERROR `await` is only allowed inside `async` functions and blocks | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/ui/async-await/async-outside-of-await-issue-121096.stderr
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,12 @@ | ||
error[E0728]: `await` is only allowed inside `async` functions and blocks | ||
--> $DIR/async-outside-of-await-issue-121096.rs:7:7 | ||
| | ||
LL | fn main() { | ||
| ---- this is not `async` | ||
... | ||
LL | }.await | ||
| ^^^^^ only allowed inside `async` functions and blocks | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0728`. |