From fb82ff754c934f6bf293ec0ca51602ea1ed76bf7 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 28 Apr 2021 19:22:48 -0700 Subject: [PATCH 1/2] Revert "Temporarily remove pat_param." This reverts commit 629e7df5dc6fda16af98bc40cd139de0e0fa73a2. --- src/macros-by-example.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/macros-by-example.md b/src/macros-by-example.md index 2682059dd..22ea8b177 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -28,7 +28,7 @@ > > _MacroFragSpec_ :\ >       `block` | `expr` | `ident` | `item` | `lifetime` | `literal`\ ->    | `meta` | `pat` | `path` | `stmt` | `tt` | `ty` | `vis` +>    | `meta` | `pat` | `pat_param` | `path` | `stmt` | `tt` | `ty` | `vis` > > _MacroRepSep_ :\ >    [_Token_]_except delimiters and repetition operators_ @@ -122,7 +122,8 @@ fragment specifiers are: * `block`: a [_BlockExpression_] * `stmt`: a [_Statement_] without the trailing semicolon (except for item statements that require semicolons) - * `pat`: a [_PatternNoTopAlt_] + * `pat_param`: a [_PatternNoTopAlt_] + * `pat`: equivalent to `pat_param` * `expr`: an [_Expression_] * `ty`: a [_Type_] * `ident`: an [IDENTIFIER_OR_KEYWORD] From 3a6ddea02244857362ac05d85ec98736b738c0ff Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 1 May 2021 14:11:26 -0700 Subject: [PATCH 2/2] Add pat_param to follow set restrictions. --- src/macros-by-example.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros-by-example.md b/src/macros-by-example.md index 22ea8b177..7d2b44709 100644 --- a/src/macros-by-example.md +++ b/src/macros-by-example.md @@ -28,7 +28,7 @@ > > _MacroFragSpec_ :\ >       `block` | `expr` | `ident` | `item` | `lifetime` | `literal`\ ->    | `meta` | `pat` | `pat_param` | `path` | `stmt` | `tt` | `ty` | `vis` +>    | `meta` | `pat` | `pat_param` | `path` | `stmt` | `tt` | `ty` | `vis` > > _MacroRepSep_ :\ >    [_Token_]_except delimiters and repetition operators_ @@ -451,7 +451,7 @@ Matchers like `$i:expr,` or `$i:expr;` would be legal, however, because `,` and `;` are legal expression separators. The specific rules are: * `expr` and `stmt` may only be followed by one of: `=>`, `,`, or `;`. - * `pat` may only be followed by one of: `=>`, `,`, `=`, `|`, `if`, or `in`. + * `pat` and `pat_param` may only be followed by one of: `=>`, `,`, `=`, `|`, `if`, or `in`. * `path` and `ty` may only be followed by one of: `=>`, `,`, `=`, `|`, `;`, `:`, `>`, `>>`, `[`, `{`, `as`, `where`, or a macro variable of `block` fragment specifier.