Skip to content

Commit 468b213

Browse files
Minor fixes to $crate behavior
1 parent 0ba97b1 commit 468b213

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/macros-by-example.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Valid fragment specifiers are:
134134
* `block`: a [BlockExpression]
135135
* `expr`: an [Expression]
136136
* `expr_2021`: an [Expression] except [UnderscoreExpression] and [ConstBlockExpression] (see [macro.decl.meta.edition2024])
137-
* `ident`: an [IDENTIFIER_OR_KEYWORD] or [RAW_IDENTIFIER]
137+
* `ident`: an [IDENTIFIER_OR_KEYWORD], [RAW_IDENTIFIER], or `$crate`
138138
* `item`: an [Item]
139139
* `lifetime`: a [LIFETIME_TOKEN]
140140
* `literal`: matches `-`<sup>?</sup>[LiteralExpression]

src/procedural-macros.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ r[macro.proc.token.conversion.to-proc_macro]
350350
When passed to a proc-macro
351351
- All multi-character operators are broken into single characters.
352352
- Lifetimes are broken into a `'` character and an identifier.
353-
- All metavariable substitutions are represented as their underlying token
354-
streams.
353+
- The keyword metavariable `$crate` is passed as a single identifier.
354+
- All other metavariable substitutions are represented as their underlying
355+
token streams.
355356
- Such token streams may be wrapped into delimited groups ([`Group`]) with
356357
implicit delimiters ([`Delimiter::None`]) when it's necessary for
357358
preserving parsing priorities.

0 commit comments

Comments
 (0)