diff options
Diffstat (limited to 'compiler/rustc_hir/src')
| -rw-r--r-- | compiler/rustc_hir/src/arena.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 24 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/intravisit.rs | 16 | 
3 files changed, 23 insertions, 23 deletions
| diff --git a/compiler/rustc_hir/src/arena.rs b/compiler/rustc_hir/src/arena.rs index c7dc66b70fe..ddf82186169 100644 --- a/compiler/rustc_hir/src/arena.rs +++ b/compiler/rustc_hir/src/arena.rs @@ -25,8 +25,8 @@ macro_rules! arena_types { [] generic_bound: rustc_hir::GenericBound<$tcx>, [] generic_param: rustc_hir::GenericParam<$tcx>, [] expr: rustc_hir::Expr<$tcx>, - [] field: rustc_hir::Field<$tcx>, - [] field_pat: rustc_hir::FieldPat<$tcx>, + [] expr_field: rustc_hir::ExprField<$tcx>, + [] pat_field: rustc_hir::PatField<$tcx>, [] fn_decl: rustc_hir::FnDecl<$tcx>, [] foreign_item: rustc_hir::ForeignItem<$tcx>, [few] foreign_item_ref: rustc_hir::ForeignItemRef<$tcx>, @@ -42,7 +42,7 @@ macro_rules! arena_types { [] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>, [] qpath: rustc_hir::QPath<$tcx>, [] stmt: rustc_hir::Stmt<$tcx>, - [] struct_field: rustc_hir::StructField<$tcx>, + [] field_def: rustc_hir::FieldDef<$tcx>, [] trait_item_ref: rustc_hir::TraitItemRef, [] ty: rustc_hir::Ty<$tcx>, [] type_binding: rustc_hir::TypeBinding<$tcx>, diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index ccc16c34fb2..82ee69058fa 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -882,7 +882,7 @@ impl<'hir> Pat<'hir> { /// are treated the same as` x: x, y: ref y, z: ref mut z`, /// except `is_shorthand` is true. #[derive(Debug, HashStable_Generic)] -pub struct FieldPat<'hir> { +pub struct PatField<'hir> { #[stable_hasher(ignore)] pub hir_id: HirId, /// The identifier for the field. @@ -946,7 +946,7 @@ pub enum PatKind<'hir> { /// A struct or struct variant pattern (e.g., `Variant {x, y, ..}`). /// The `bool` is `true` in the presence of a `..`. - Struct(QPath<'hir>, &'hir [FieldPat<'hir>], bool), + Struct(QPath<'hir>, &'hir [PatField<'hir>], bool), /// A tuple struct/variant pattern `Variant(x, y, .., z)`. /// If the `..` pattern fragment is present, then `Option<usize>` denotes its position. @@ -1203,7 +1203,7 @@ pub enum Guard<'hir> { } #[derive(Debug, HashStable_Generic)] -pub struct Field<'hir> { +pub struct ExprField<'hir> { #[stable_hasher(ignore)] pub hir_id: HirId, pub ident: Ident, @@ -1762,7 +1762,7 @@ pub enum ExprKind<'hir> { /// /// E.g., `Foo {x: 1, y: 2}`, or `Foo {x: 1, .. base}`, /// where `base` is the `Option<Expr>`. - Struct(&'hir QPath<'hir>, &'hir [Field<'hir>], Option<&'hir Expr<'hir>>), + Struct(&'hir QPath<'hir>, &'hir [ExprField<'hir>], Option<&'hir Expr<'hir>>), /// An array literal constructed from one repeated element. /// @@ -2623,7 +2623,7 @@ impl VisibilityKind<'_> { } #[derive(Debug, HashStable_Generic)] -pub struct StructField<'hir> { +pub struct FieldDef<'hir> { pub span: Span, #[stable_hasher(project(name))] pub ident: Ident, @@ -2632,7 +2632,7 @@ pub struct StructField<'hir> { pub ty: &'hir Ty<'hir>, } -impl StructField<'_> { +impl FieldDef<'_> { // Still necessary in couple of places pub fn is_positional(&self) -> bool { let first = self.ident.as_str().as_bytes()[0]; @@ -2646,11 +2646,11 @@ pub enum VariantData<'hir> { /// A struct variant. /// /// E.g., `Bar { .. }` as in `enum Foo { Bar { .. } }`. - Struct(&'hir [StructField<'hir>], /* recovered */ bool), + Struct(&'hir [FieldDef<'hir>], /* recovered */ bool), /// A tuple variant. /// /// E.g., `Bar(..)` as in `enum Foo { Bar(..) }`. - Tuple(&'hir [StructField<'hir>], HirId), + Tuple(&'hir [FieldDef<'hir>], HirId), /// A unit variant. /// /// E.g., `Bar = ..` as in `enum Foo { Bar = .. }`. @@ -2659,7 +2659,7 @@ pub enum VariantData<'hir> { impl VariantData<'hir> { /// Return the fields of this variant. - pub fn fields(&self) -> &'hir [StructField<'hir>] { + pub fn fields(&self) -> &'hir [FieldDef<'hir>] { match *self { VariantData::Struct(ref fields, ..) | VariantData::Tuple(ref fields, ..) => fields, _ => &[], @@ -2967,7 +2967,7 @@ pub enum Node<'hir> { TraitItem(&'hir TraitItem<'hir>), ImplItem(&'hir ImplItem<'hir>), Variant(&'hir Variant<'hir>), - Field(&'hir StructField<'hir>), + Field(&'hir FieldDef<'hir>), AnonConst(&'hir AnonConst), Expr(&'hir Expr<'hir>), Stmt(&'hir Stmt<'hir>), @@ -2998,7 +2998,7 @@ impl<'hir> Node<'hir> { Node::TraitItem(TraitItem { ident, .. }) | Node::ImplItem(ImplItem { ident, .. }) | Node::ForeignItem(ForeignItem { ident, .. }) - | Node::Field(StructField { ident, .. }) + | Node::Field(FieldDef { ident, .. }) | Node::Variant(Variant { ident, .. }) | Node::MacroDef(MacroDef { ident, .. }) | Node::Item(Item { ident, .. }) => Some(*ident), @@ -3046,7 +3046,7 @@ impl<'hir> Node<'hir> { | Node::ImplItem(ImplItem { def_id, .. }) | Node::ForeignItem(ForeignItem { def_id, .. }) | Node::MacroDef(MacroDef { def_id, .. }) => Some(HirId::make_owner(*def_id)), - Node::Field(StructField { hir_id, .. }) + Node::Field(FieldDef { hir_id, .. }) | Node::AnonConst(AnonConst { hir_id, .. }) | Node::Expr(Expr { hir_id, .. }) | Node::Stmt(Stmt { hir_id, .. }) diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index df63f0d48c3..1ed8ab044fe 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -415,8 +415,8 @@ pub trait Visitor<'v>: Sized { ) { walk_struct_def(self, s) } - fn visit_struct_field(&mut self, s: &'v StructField<'v>) { - walk_struct_field(self, s) + fn visit_field_def(&mut self, s: &'v FieldDef<'v>) { + walk_field_def(self, s) } fn visit_enum_def( &mut self, @@ -1045,14 +1045,14 @@ pub fn walk_struct_def<'v, V: Visitor<'v>>( struct_definition: &'v VariantData<'v>, ) { walk_list!(visitor, visit_id, struct_definition.ctor_hir_id()); - walk_list!(visitor, visit_struct_field, struct_definition.fields()); + walk_list!(visitor, visit_field_def, struct_definition.fields()); } -pub fn walk_struct_field<'v, V: Visitor<'v>>(visitor: &mut V, struct_field: &'v StructField<'v>) { - visitor.visit_id(struct_field.hir_id); - visitor.visit_vis(&struct_field.vis); - visitor.visit_ident(struct_field.ident); - visitor.visit_ty(&struct_field.ty); +pub fn walk_field_def<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v FieldDef<'v>) { + visitor.visit_id(field.hir_id); + visitor.visit_vis(&field.vis); + visitor.visit_ident(field.ident); + visitor.visit_ty(&field.ty); } pub fn walk_block<'v, V: Visitor<'v>>(visitor: &mut V, block: &'v Block<'v>) { | 
