Closed
Description
The following code:
async fn weird() {
1 = 2;
let mut loop_count = 0;
async {}.await
}
fn main() {}
produces the following errors:
error[E0070]: invalid left-hand side of assignment
--> src/main.rs:2:7
|
2 | 1 = 2;
| - ^
| |
| cannot assign to this expression
error[E0698]: type inside `async fn` body must be known in this context
--> src/main.rs:4:9
|
4 | let mut loop_count = 0;
| ^^^^^^^^^^^^^^ cannot infer type for type `{integer}`
|
note: the type is part of the `async fn` body because of this `await`
--> src/main.rs:5:5
|
5 | async {}.await
| ^^^^^^^^^^^^^^
error: aborting due to 2 previous errors
The "type inside async fn
body must be known in this context" error is spurious, and disappears if the 1 = 2;
line is removed.
Metadata
Metadata
Assignees
Labels
Area: Async & AwaitArea: Messages for errors, warnings, and lintsAsync-await issues that have been triaged during a working group meeting.Category: This is a bug.Diagnostics: Too much output caused by a single piece of incorrect code.Relevant to the compiler team, which will review and decide on the PR/issue.