Skip to content

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

Closed
@kuretchi

Description

@kuretchi
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions