diff options
| author | Trevor Gross <tmgross@umich.edu> | 2025-06-17 22:15:38 -0400 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-06-24 04:37:36 -0400 |
| commit | b9e9be38c01104dd7e1a23995ef89995357bd35b (patch) | |
| tree | 0b8b8fba254888597f1de25d2180d22e68210257 /compiler/rustc_expand/src/mbe.rs | |
| parent | be927caf063b5da94cae8f3f697d190f83115a4f (diff) | |
| download | rust-b9e9be38c01104dd7e1a23995ef89995357bd35b.tar.gz rust-b9e9be38c01104dd7e1a23995ef89995357bd35b.zip | |
mbe: Clean up code with non-optional `NonterminalKind`
Since [1], 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. [1]: 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(), |
