Skip to content

Minor fixes to $crate behavior #1816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/macros-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Valid fragment specifiers are:
* `block`: a [BlockExpression]
* `expr`: an [Expression]
* `expr_2021`: an [Expression] except [UnderscoreExpression] and [ConstBlockExpression] (see [macro.decl.meta.edition2024])
* `ident`: an [IDENTIFIER_OR_KEYWORD] or [RAW_IDENTIFIER]
* `ident`: an [IDENTIFIER_OR_KEYWORD], [RAW_IDENTIFIER], or `$crate`
* `item`: an [Item]
* `lifetime`: a [LIFETIME_TOKEN]
* `literal`: matches `-`<sup>?</sup>[LiteralExpression]
Expand Down
5 changes: 3 additions & 2 deletions src/procedural-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,9 @@ r[macro.proc.token.conversion.to-proc_macro]
When passed to a proc-macro
- All multi-character operators are broken into single characters.
- Lifetimes are broken into a `'` character and an identifier.
- All metavariable substitutions are represented as their underlying token
streams.
- The keyword metavariable `$crate` is passed as a single identifier.
- All other metavariable substitutions are represented as their underlying
token streams.
- Such token streams may be wrapped into delimited groups ([`Group`]) with
implicit delimiters ([`Delimiter::None`]) when it's necessary for
preserving parsing priorities.
Expand Down