Skip to content

Commit

Permalink
Rollup merge of rust-lang#126851 - nnethercote:NtExprKind-NtPatKind, …
Browse files Browse the repository at this point in the history
…r=compiler-errors

Rework pattern and expression nonterminal kinds.

Some tweaks to `NonterminalKind` that will assist with rust-lang#124141. Details in the individual commits.

r? compiler-errors
cc ```@eholk```
  • Loading branch information
matthiaskrgr authored Jun 23, 2024
2 parents 081ae53 + 5faf95c commit 8f8a463
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/parse/macros/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use rustc_ast::token::{Delimiter, NonterminalKind, TokenKind};
use rustc_ast::token::{Delimiter, NonterminalKind, NtExprKind::*, NtPatKind::*, TokenKind};
use rustc_ast::tokenstream::TokenStream;
use rustc_ast::{ast, ptr};
use rustc_parse::parser::{ForceCollect, Parser, Recovery};
Expand Down Expand Up @@ -48,7 +48,7 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {

parse_macro_arg!(
Expr,
NonterminalKind::Expr,
NonterminalKind::Expr(Expr),
|parser: &mut Parser<'b>| parser.parse_expr(),
|x: ptr::P<ast::Expr>| Some(x)
);
Expand All @@ -60,7 +60,7 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
);
parse_macro_arg!(
Pat,
NonterminalKind::PatParam { inferred: false },
NonterminalKind::Pat(PatParam { inferred: false }),
|parser: &mut Parser<'b>| parser.parse_pat_no_top_alt(None, None),
|x: ptr::P<ast::Pat>| Some(x)
);
Expand Down

0 comments on commit 8f8a463

Please sign in to comment.