Open gnzlbg opened 7 years ago
Doesn't seem up to date. Seems like a vestige of the days before user defined proc macros were possible.
I think this is outdated too, right?
As previously mentioned, macro processing in Rust happens after the construction of the AST. As such, the syntax used to invoke a macro must be a proper part of the language's syntax.
Also imo it is contradicted by this paragraph below:
Disregarding all but the third form (
$name ! $arg
), the question becomes: how does the Rust parser know what$arg
looks like for every possible syntax extension? The answer is that it doesn't have to. Instead, the argument of a syntax extension invocation is a single token tree.
To me it seems, the chapter would be more accurate if these two sentences above were removed completely. Should I make a PR?
Macro processing does happen after construction of the AST. There is just a special AST node for macro calls that contains a token tree.
No changes have been merged for five years now.
The macros in the AST section says:
(emphasis mine)
But a custom-derive macro can use these forms, right? (otherwise sorry for the noise).