Auto merge of #83188 - petrochenkov:field, r=lcnr
ast/hir: Rename field-related structures
I always forget what `ast::Field` and `ast::StructField` mean despite working with AST for long time, so this PR changes the naming to less confusing and more consistent.
- `StructField` -> `FieldDef` ("field definition")
- `Field` -> `ExprField` ("expression field", not "field expression")
- `FieldPat` -> `PatField` ("pattern field", not "field pattern")
Various visiting and other methods working with the fields are renamed correspondingly too.
The second commit reduces the size of `ExprKind` by boxing fields of `ExprKind::Struct` in preparation for https://github.com/rust-lang/rust/pull/80080.
This commit is contained in:
@@ -2559,8 +2559,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
&mut self,
|
||||
span: Span,
|
||||
pat: &'hir hir::Pat<'hir>,
|
||||
) -> &'hir [hir::FieldPat<'hir>] {
|
||||
let field = hir::FieldPat {
|
||||
) -> &'hir [hir::PatField<'hir>] {
|
||||
let field = hir::PatField {
|
||||
hir_id: self.next_id(),
|
||||
ident: Ident::new(sym::integer(0), span),
|
||||
is_shorthand: false,
|
||||
@@ -2574,7 +2574,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
&mut self,
|
||||
span: Span,
|
||||
lang_item: hir::LangItem,
|
||||
fields: &'hir [hir::FieldPat<'hir>],
|
||||
fields: &'hir [hir::PatField<'hir>],
|
||||
) -> &'hir hir::Pat<'hir> {
|
||||
let qpath = hir::QPath::LangItem(lang_item, span);
|
||||
self.pat(span, hir::PatKind::Struct(qpath, fields, false))
|
||||
|
||||
Reference in New Issue
Block a user