Skip to content

Commit b2c3270

Browse files
committed
Linkify $crate
1 parent 468b213 commit b2c3270

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/macros-by-example.md

Lines changed: 4 additions & 3 deletions
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], [RAW_IDENTIFIER], or `$crate`
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]
@@ -151,10 +151,10 @@ r[macro.decl.meta.transcription]
151151
In the transcriber, metavariables are referred to simply by `$`_name_, since
152152
the fragment kind is specified in the matcher. Metavariables are replaced with
153153
the syntax element that matched them.
154+
Metavariables can be transcribed more than once or not at all.
154155

155156
r[macro.decl.meta.dollar-crate]
156-
The keyword metavariable `$crate` can be used to refer to the current crate; see [Hygiene] below. Metavariables can be
157-
transcribed more than once or not at all.
157+
The keyword metavariable [`$crate`] can be used to refer to the current crate.
158158

159159
r[macro.decl.meta.edition2021]
160160
> [!EDITION-2021]
@@ -594,3 +594,4 @@ For more detail, see the [formal specification].
594594
[Metavariables]: #metavariables
595595
[Repetitions]: #repetitions
596596
[token]: tokens.md
597+
[`$crate`]: macro.decl.hygiene.crate

src/paths.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@ r[paths.qualifiers.macro-crate]
368368
### `$crate`
369369

370370
r[paths.qualifiers.macro-crate.allowed-positions]
371-
`$crate` is only used within [macro transcribers], and can only be used as the first
371+
[`$crate`] is only used within [macro transcribers], and can only be used as the first
372372
segment, without a preceding `::`.
373373

374374
r[paths.qualifiers.macro-crate.hygiene]
375-
`$crate` will expand to a path to access items from the
375+
[`$crate`] will expand to a path to access items from the
376376
top level of the crate where the macro is defined, regardless of which crate the macro is
377377
invoked.
378378

@@ -472,6 +472,7 @@ mod without { // crate::without
472472
# fn main() {}
473473
```
474474

475+
[`$crate`]: macro.decl.hygiene.crate
475476
[implementations]: items/implementations.md
476477
[items]: items.md
477478
[literal]: expressions/literal-expr.md

0 commit comments

Comments
 (0)