Skip to content

await is not treated as a plain token in a macro #57919

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

Closed
kuretchi opened this issue Jan 26, 2019 · 2 comments
Closed

await is not treated as a plain token in a macro #57919

kuretchi opened this issue Jan 26, 2019 · 2 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The lexing & parsing of Rust source code to an AST

Comments

@kuretchi
Copy link

macro_rules! m {
    ($($t:tt)*) => {};
}
m! { async try dyn await }

Compiling this code on the 2018 edition causes an following error:

error[E0721]: `await` is a keyword in the 2018 edition
 --> src/main.rs:4:20
  |
4 | m! { async try dyn await }
  |                    ^^^^^ help: you can use a raw identifier to stay compatible: `r#await`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0721`.

However, as with other keywords, this await keyword should be ignored through ($($t:tt)*) => {};.

Playground

@estebank estebank added A-parser Area: The lexing & parsing of Rust source code to an AST A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) labels Jan 26, 2019
@varkor
Copy link
Member

varkor commented Feb 23, 2019

This is essentially due to #54411.

The problem is that await isn't a true keyword and has been given a custom error message (triggering eagerly), which doesn't have the same handling as normal keyword use errors. It seems simplest to leave this unaddressed until the await syntax has been chosen and we can use await as a true keyword.

@dtolnay
Copy link
Member

dtolnay commented Jul 28, 2019

Fixed in 1.36.0.

@dtolnay dtolnay closed this as completed Jul 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-parser Area: The lexing & parsing of Rust source code to an AST
Projects
None yet
Development

No branches or pull requests

4 participants