Skip to content

await as a keyword and await! macro #53834

Closed
@withoutboats

Description

@withoutboats

We intend for await to be a keyword in the 2018 edition, this causes a tricky problem: currently, await! is a macro, not using "normal" control flow syntax, because we haven't decided exactly how the syntax should work (see the RFC unresolved questions for more context). But macros are not supposed to be able to have keywords as names.

It's now the case that not only does std have an await! macro, but other libraries are defining them also to handle compatibility between different versions of futures, specifically tokio-async-await.

I propose this solution to the problem:

  1. On 2018, await is a true keyword - a macro named await would be invalid.
  2. Under the await_macro feature, the await keyword is disabled, allowing users (including std) to use await as a macro name.
  3. Before we stabilize async/await, we resolve the syntactic question for await and make await a keyword again. This will break anyone using await as a macro name, but they were already on nightly, and expected this breakage.

This avoids special casing std await!, making the behavior on stable for 2018 simple and allowing tokio-async-await to keep its await! macro.

cc @carllerche @Centril @cramertj

Metadata

Metadata

Assignees

Labels

A-edition-2018Area: The 2018 editionF-rust_2018_preview`#![feature(rust_2018_preview)]`P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamWG-epochWorking group: Epoch (2018) management

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions