1
Fork 0
rust/compiler/rustc_parse/src
Nicholas Nethercote e2aa38e6ab Rework pattern and expression nonterminal kinds.
Merge `PatParam`/`PatWithOr`, and `Expr`/`Expr2021`, for a few reasons.

- It's conceptually nice, because the two pattern kinds and the two
  expression kinds are very similar.

- With expressions in particular, there are several places where both
  expression kinds get the same treatment.

- It removes one unreachable match arm.

- Most importantly, for #124141 I will need to introduce a new type
  `MetaVarKind` that is very similar to `NonterminalKind`, but records a
  couple of extra fields for expression metavars. It's nicer to have a
  single `MetaVarKind::Expr` expression variant to hold those extra
  fields instead of duplicating them across two variants
  `MetaVarKind::{Expr,Expr2021}`. And then it makes sense for patterns
  to be treated the same way, and for `NonterminalKind` to also be
  treated the same way.

I also clarified the comments, because I have long found them a little
hard to understand.
2024-06-23 15:57:24 +10:00
..
lexer Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
parser Rework pattern and expression nonterminal kinds. 2024-06-23 15:57:24 +10:00
errors.rs Auto merge of #126678 - nnethercote:fix-duplicated-attrs-on-nt-expr, r=petrochenkov 2024-06-19 13:58:21 +00:00
lib.rs Prefer dcx methods over fields or fields' methods 2024-06-18 13:45:08 +00:00
validate_attr.rs Prefer dcx methods over fields or fields' methods 2024-06-18 13:45:08 +00:00