-
Notifications
You must be signed in to change notification settings - Fork 13.3k
await as a keyword and await!
macro
#53834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I'm not sure that I follow. Isn't |
The proposal is that await will become a reserved keyword in 2018 unless you turn on the Eventually, we plan to settle on a permanent syntax for |
I presume this will involve promoting the |
@withoutboats ah, I see. Either way, I think that I will have to switch to an alternate macro name. I don't expect the move off of futures 0.1 to be fast, so the transition plan will have to stretch into the 2018 edition. |
@carllerche the feature will exist until async/await is stabilized, which is well after the 2018 edition is released |
@withoutboats Ah, that makes sense, thanks. |
A more straightforward solution is to always parse the identifier in the sequence not as a keyword, but as a macro name. I think it is backwards compatible, though it does complicate things a bit. |
We discussed this in lang team today and we agreed to do this: on 2018 stable, |
When I went to implement this I realized that we can't just specifically parse To clarify why we can't just change parsing based on the |
As long as we retain the ability to eventually make it a true keyword in edition 2018, that sounds good to me. |
So I talked to @cramertj about how to implement this and we ran into the problem previously described. I had two ideas for possible ways to fix this: Option 1. Never treat rust/src/librustc_lint/builtin.rs Lines 1891 to 1970 in 3bc2ca7
It would work mildly differently. I think it would work like this:
|
OK, never mind, just Option 1. Option 2 just seemed like strictly more work so I leave it off. :) |
Make "await" a pseudo-edition keyword This change makes "await" ident an error in 2018 edition without async_await feature and adds "await" to the 2018 edition keyword lint group that suggest migration on the 2015 edition. cc #53834 r? @nikomatsakis
visited for triage. As far as we can tell, this was fixed by PR #54411. |
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:
await
is a true keyword - a macro namedawait
would be invalid.await_macro
feature, theawait
keyword is disabled, allowing users (including std) to useawait
as a macro name.await
and makeawait
a keyword again. This will break anyone usingawait
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 itsawait!
macro.cc @carllerche @Centril @cramertj
The text was updated successfully, but these errors were encountered: