Skip to content

Remove macro placeholders from strict keyword restrictions - #2430

Open
firmiana402 wants to merge 1 commit into
rust-lang:masterfrom
firmiana402:fix-keywords-macro-placeholders
Open

firmiana402 wants to merge 1 commit into
rust-lang:masterfrom
firmiana402:fix-keywords-macro-placeholders

Conversation

@firmiana402

@firmiana402 firmiana402 commented Nov 30, 2026 •

Copy link
Copy Markdown

lex.keywords.strict.intro incorrectly lists "Macro placeholders" as a context where strict keywords (and by extension reserved keywords, per lex.keywords.reserved.intro) cannot be used.

In fact, as specified by macro.decl.syntax, macro metavariable names accept any IDENTIFIER_OR_KEYWORD except crate (as well as raw identifiers), so all strict and reserved keywords other than crate are valid (e.g., $fn:expr, $_:tt, $abstract:expr). Only crate is excluded because $crate is a special keyword metavariable (macro.decl.meta.dollar-crate).

Previously, #1130 fixed this in src/macros-by-example.md to document that metavariable names may be keywords other than crate, but src/keywords.md was missed.

This PR removes * [Macro placeholders] and its unused link definition.

Per r[macro.decl.syntax], macro metavariable names accept IDENTIFIER_OR_KEYWORD (except crate) as well as raw identifiers, so strict and reserved keywords (other than crate) are valid macro metavariable names.
@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: The marked PR is awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants