reference icon indicating copy to clipboard operation
reference copied to clipboard

Clarify proc-macro token tree

Open ehuss opened this issue 3 months ago • 3 comments

This attempts to clarify some details about proc-macro tokens, in particular the differences in handling _ from macro_rules. This includes several changes:

  • Removed the wordy description of a macro_rules TokenTree. This is already defined in the grammar in more detail. This does remove the sentence discussing metavariable substitutions. I would prefer to defer this to a more detailed description in the macro_rules chapter on how metavariable substitutions work.
  • Removed the English description of a proc-macro token tree, and instead write it as a grammar production.

Closes https://github.com/rust-lang/reference/issues/2020 Closes https://github.com/rust-lang/reference/issues/1236

ehuss avatar Sep 29 '25 09:09 ehuss

r? @petrochenkov

petrochenkov avatar Sep 29 '25 12:09 petrochenkov

@rustbot author (I don't have rights to change labels directly here.)

petrochenkov avatar Sep 29 '25 17:09 petrochenkov

Reminder, once the PR becomes ready for a review, use @rustbot ready.

rustbot avatar Sep 29 '25 17:09 rustbot