Skip to content

Commit

Permalink
Merge pull request #1641 from ehuss/sort-fragments
Browse files Browse the repository at this point in the history
Sort macro fragment specifiers
  • Loading branch information
traviscross authored Oct 22, 2024
2 parents cfaf525 + 91dc88b commit d953a36
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/macros-by-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,22 +137,21 @@ fragment of the kind specified and binds it to the metavariable `$`_name_.
r[macro.decl.meta.specifier]
Valid fragment specifiers are:

* `item`: an [_Item_]
* `block`: a [_BlockExpression_]
* `stmt`: a [_Statement_] without the trailing semicolon (except for item
statements that require semicolons)
* `pat_param`: a [_PatternNoTopAlt_]
* `pat`: at least any [_PatternNoTopAlt_], and possibly more depending on edition
* `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]
* `item`: an [_Item_]
* `lifetime`: a [LIFETIME_TOKEN]
* `literal`: matches `-`<sup>?</sup>[_LiteralExpression_]
* `meta`: an [_Attr_], the contents of an attribute
* `pat`: at least any [_PatternNoTopAlt_], and possibly more depending on edition
* `pat_param`: a [_PatternNoTopAlt_]
* `path`: a [_TypePath_] style path
* `stmt`: a [_Statement_] without the trailing semicolon (except for item statements that require semicolons)
* `tt`: a [_TokenTree_]&nbsp;(a single [token] or tokens in matching delimiters `()`, `[]`, or `{}`)
* `meta`: an [_Attr_], the contents of an attribute
* `lifetime`: a [LIFETIME_TOKEN]
* `ty`: a [_Type_]
* `vis`: a possibly empty [_Visibility_] qualifier
* `literal`: matches `-`<sup>?</sup>[_LiteralExpression_]

r[macro.decl.meta.transcription]
In the transcriber, metavariables are referred to simply by `$`_name_, since
Expand Down

0 comments on commit d953a36

Please sign in to comment.