You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*`pat`: at least any [_PatternNoTopAlt_], and possibly more depending on edition
129
129
*`expr`: an [_Expression_]
130
+
*`expr_2021` an [_Expression_] except [_UnderscoreExpression_] and [_ConstBlockExpression_]
130
131
*`ty`: a [_Type_]
131
132
*`ident`: an [IDENTIFIER_OR_KEYWORD] or [RAW_IDENTIFIER]
132
133
*`path`: a [_TypePath_] style path
@@ -142,16 +143,13 @@ the syntax element that matched them. The keyword metavariable `$crate` can be
142
143
used to refer to the current crate; see [Hygiene] below. Metavariables can be
143
144
transcribed more than once or not at all.
144
145
145
-
For reasons of backwards compatibility, though `_`[is also an
146
-
expression][_UnderscoreExpression_], a standalone underscore is not matched by
147
-
the `expr` fragment specifier. However, `_` is matched by the `expr` fragment
148
-
specifier when it appears as a subexpression.
149
-
For the same reason, a standalone [const block] is not matched but it is matched when appearing as a subexpression.
150
-
151
146
> **Edition Differences**: Starting with the 2021 edition, `pat` fragment-specifiers match top-level or-patterns (that is, they accept [_Pattern_]).
152
147
>
153
148
> Before the 2021 edition, they match exactly the same fragments as `pat_param` (that is, they accept [_PatternNoTopAlt_]).
154
149
>
150
+
> Before the 2024 edition, `expr` fragment specifiers do not match [_UnderscoreExpression_] or [_ConstBlockExpression_] at the top level. They are allowed within subexpressions.
151
+
> The `expr_2021` fragment specifier exists as a way to maintain backwards compatibility if needed.
152
+
>
155
153
> The relevant edition is the one in effect for the `macro_rules!` definition.
156
154
157
155
## Repetitions
@@ -493,7 +491,7 @@ expansions, taking separators into account. This means:
0 commit comments