diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-06-24 20:46:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 20:46:03 +0200 |
| commit | 9f384c414c1c72c52aa4ff43366de59aa1f0d61d (patch) | |
| tree | 8e0119e6b49acc5fec7d0881a2d9f54d37917c16 /compiler/rustc_expand/src/mbe.rs | |
| parent | 27819a009da72a5e6d90ae11c93595b32824deba (diff) | |
| parent | cd5de49eaa522ee10c0e8a6b36a067791270dca2 (diff) | |
| download | rust-9f384c414c1c72c52aa4ff43366de59aa1f0d61d.tar.gz rust-9f384c414c1c72c52aa4ff43366de59aa1f0d61d.zip | |
Rollup merge of #142657 - tgross35:nonoptional-fragment-specifiers-cleanup, r=petrochenkov
mbe: Clean up code with non-optional `NonterminalKind` Since [rust-lang/rust#128425], the fragment specifier is unconditionally required in all editions. This means `NonTerminalKind` no longer needs to be optional, as we can reject this code during the expansion of `macro_rules!` rather than handling it throughout the code. Do this cleanup here. [rust-lang/rust#128425]: https://github.com/rust-lang/rust/pull/128425
Diffstat (limited to 'compiler/rustc_expand/src/mbe.rs')
| -rw-r--r-- | compiler/rustc_expand/src/mbe.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_expand/src/mbe.rs b/compiler/rustc_expand/src/mbe.rs index 4ff8c02bcdb..3082c881a7a 100644 --- a/compiler/rustc_expand/src/mbe.rs +++ b/compiler/rustc_expand/src/mbe.rs @@ -78,7 +78,13 @@ enum TokenTree { /// only covers the ident, e.g. `var`.) MetaVar(Span, Ident), /// e.g., `$var:expr`. Only appears on the LHS. - MetaVarDecl(Span, Ident /* name to bind */, Option<NonterminalKind>), + MetaVarDecl { + span: Span, + /// Name to bind. + name: Ident, + /// The fragment specifier. + kind: NonterminalKind, + }, /// A meta-variable expression inside `${...}`. MetaVarExpr(DelimSpan, MetaVarExpr), } @@ -102,7 +108,7 @@ impl TokenTree { match *self { TokenTree::Token(Token { span, .. }) | TokenTree::MetaVar(span, _) - | TokenTree::MetaVarDecl(span, _, _) => span, + | TokenTree::MetaVarDecl { span, .. } => span, TokenTree::Delimited(span, ..) | TokenTree::MetaVarExpr(span, _) | TokenTree::Sequence(span, _) => span.entire(), |
