diff options
| author | Eric Holk <ericholk@microsoft.com> | 2024-04-12 10:19:23 -0700 |
|---|---|---|
| committer | Eric Holk <ericholk@microsoft.com> | 2024-05-13 11:27:26 -0700 |
| commit | ef6478ba5fde1a1ed6db27fc7f558bc26e38d781 (patch) | |
| tree | 5aa3810b035d94d717ce85e1c0010f2e2d566b06 /compiler/rustc_parse/src | |
| parent | 030a12ce2b1ee42f2d8837b1b500fd9cf12ea191 (diff) | |
| download | rust-ef6478ba5fde1a1ed6db27fc7f558bc26e38d781.tar.gz rust-ef6478ba5fde1a1ed6db27fc7f558bc26e38d781.zip | |
Add expr_2021 nonterminal and feature flag
This commit adds a new nonterminal `expr_2021` in macro patterns, and `expr_fragment_specifier_2024` feature flag. For now, `expr` and `expr_2021` are treated the same, but in future PRs we will update `expr` to match to new grammar. Co-authored-by: Vincezo Palazzo <vincenzopalazzodev@gmail.com>
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/nonterminal.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/nonterminal.rs b/compiler/rustc_parse/src/parser/nonterminal.rs index 73b17353ac9..dc51d85792c 100644 --- a/compiler/rustc_parse/src/parser/nonterminal.rs +++ b/compiler/rustc_parse/src/parser/nonterminal.rs @@ -37,7 +37,7 @@ impl<'a> Parser<'a> { } match kind { - NonterminalKind::Expr => { + NonterminalKind::Expr | NonterminalKind::Expr2021 => { token.can_begin_expr() // This exception is here for backwards compatibility. && !token.is_keyword(kw::Let) @@ -145,7 +145,9 @@ impl<'a> Parser<'a> { })?) } - NonterminalKind::Expr => NtExpr(self.parse_expr_force_collect()?), + NonterminalKind::Expr | NonterminalKind::Expr2021 => { + NtExpr(self.parse_expr_force_collect()?) + } NonterminalKind::Literal => { // The `:literal` matcher does not support attributes NtLiteral(self.collect_tokens_no_attrs(|this| this.parse_literal_maybe_minus())?) |
