Why is `async` a keyword?

#1

I was reading the async RFC and I see that async used to be an attribute, but today it is a keyword. Why was that changed? I like the symmetry between #[async] and await!(), because it hints at a world where coroutines could have been implemented as a proc macro. With async being a keyword, that symmetry is gone. Why was await left behind? Is there somewhere I can read more about this change?

0 Likes

#2

await! is not going to be a macro forever; it is only that way today as a stopgap while the final syntax is decided.

0 Likes

#3

Note that await actually is a keyword in Rust 2018. However, enabling the async_await feature flag on nightly currently un-keywords it, for compatibility with the experimental syntax.

0 Likes

#4

https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md is the actual async/await RFC, and it says https://github.com/rust-lang/rfcs/blob/master/text/2394-async_await.md#built-in-syntax-instead-of-using-macros-in-generators

1 Like

#5

Looks like I was reading the wrong RFC, thanks for the links!

0 Likes