Skip to content
Merged
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/macro-ambiguity.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ represent simple nonterminals with the given fragment specifier.

* FOLLOW(pat) = {`=>`, `,`, `=`, `|`, `if`, `in`}`.

* FOLLOW(expr) = FOLLOW(stmt) = {`=>`, `,`, `;`}`.
* FOLLOW(expr) = FOLLOW(expr_2021) = FOLLOW(stmt) = {`=>`, `,`, `;`}`.

* FOLLOW(ty) = FOLLOW(path) = {`{`, `[`, `,`, `=>`, `:`, `=`, `>`, `>>`, `;`,
`|`, `as`, `where`, block nonterminals}.
Expand Down
8 changes: 6 additions & 2 deletions src/macros-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ r[macro.decl.syntax]
> &nbsp;&nbsp; | `$` `(` _MacroMatch_<sup>+</sup> `)` _MacroRepSep_<sup>?</sup> _MacroRepOp_
>
> _MacroFragSpec_ :\
> &nbsp;&nbsp; &nbsp;&nbsp; `block` | `expr` | `ident` | `item` | `lifetime` | `literal`\
> &nbsp;&nbsp; &nbsp;&nbsp; `block` | `expr` | `expr_2021` | `ident` | `item` | `lifetime` | `literal`\
> &nbsp;&nbsp; | `meta` | `pat` | `pat_param` | `path` | `stmt` | `tt` | `ty` | `vis`
>
> _MacroRepSep_ :\
Expand Down Expand Up @@ -143,7 +143,8 @@ Valid fragment specifiers are:
statements that require semicolons)
* `pat_param`: a [_PatternNoTopAlt_]
* `pat`: at least any [_PatternNoTopAlt_], and possibly more depending on edition
* `expr`: an [_Expression_]
* `expr`: an [_Expression_] except [_UnderscoreExpression_] and [_ConstBlockExpression_] (see [macro.decl.meta.expr-underscore])
* `expr_2021`: same as `expr` (see [macro.decl.meta.edition2021])
* `ty`: a [_Type_]
* `ident`: an [IDENTIFIER_OR_KEYWORD] or [RAW_IDENTIFIER]
* `path`: a [_TypePath_] style path
Expand Down Expand Up @@ -175,6 +176,8 @@ r[macro.decl.meta.edition2021]
> Before the 2021 edition, they match exactly the same fragments as `pat_param` (that is, they accept [_PatternNoTopAlt_]).
>
> The relevant edition is the one in effect for the `macro_rules!` definition.
>
> The `expr_2021` fragment specifier exists to maintain backwards compatibility with editions before 2024.

## Repetitions

Expand Down Expand Up @@ -572,6 +575,7 @@ For more detail, see the [formal specification].
[Repetitions]: #repetitions
[_Attr_]: attributes.md
[_BlockExpression_]: expressions/block-expr.md
[_ConstBlockExpression_]: expressions/block-expr.md#const-blocks
[_DelimTokenTree_]: macros.md
[_Expression_]: expressions.md
[_Item_]: items.md
Expand Down