Skip to content

Unclear compiler output for move async -> async move #79694

Closed
@diondokter

Description

@diondokter

I tried this code:

fn main() {
    move async {
        
    };
}

This should give a suggestion to reorder the keywords to async move, something like:

`move async` is not a valid order for these keywords. Did you mean `async move`?

Right now it gives this error, which is not very helpful:

   Compiling playground v0.0.1 (/playground)
error: expected one of `|` or `||`, found keyword `async`
 --> src/main.rs:2:10
  |
2 |     move async {
  |          ^^^^^ expected one of `|` or `||`

error: aborting due to previous error

error: could not compile `playground`

To learn more, run the command again with --verbose.

Playground link

Tested on 1.48.0 and 1.50.0-nightly (2020-12-03 5be3f9f)

Metadata

Metadata

Assignees

Labels

A-async-awaitArea: Async & AwaitA-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTAsyncAwait-TriagedAsync-await issues that have been triaged during a working group meeting.C-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.E-help-wantedCall for participation: Help is requested to fix this issue.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions