Skip to content

Commit b35ea5f

Browse files
committed
rustc: rename hir::Node::Field to StructField for consistency.
1 parent 3f0e164 commit b35ea5f

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

src/librustc/hir/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
551551
}
552552

553553
fn visit_struct_field(&mut self, field: &'hir StructField) {
554-
self.insert(field.span, field.hir_id, Node::Field(field));
554+
self.insert(field.span, field.hir_id, Node::StructField(field));
555555
self.with_parent(field.hir_id, |this| {
556556
intravisit::walk_struct_field(this, field);
557557
});

src/librustc/hir/map/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl<'hir> Map<'hir> {
384384
DefKind::Ctor(ctor_of, def::CtorKind::from_hir(variant_data))
385385
}
386386
Node::AnonConst(_) |
387-
Node::Field(_) |
387+
Node::StructField(_) |
388388
Node::Expr(_) |
389389
Node::Stmt(_) |
390390
Node::PathSegment(_) |
@@ -990,7 +990,7 @@ impl<'hir> Map<'hir> {
990990
Node::ImplItem(ii) => ii.ident.name,
991991
Node::TraitItem(ti) => ti.ident.name,
992992
Node::Variant(v) => v.ident.name,
993-
Node::Field(f) => f.ident.name,
993+
Node::StructField(f) => f.ident.name,
994994
Node::Lifetime(lt) => lt.name.ident().name,
995995
Node::GenericParam(param) => param.name.ident().name,
996996
Node::Binding(&Pat { kind: PatKind::Binding(_, _, l, _), .. }) => l.name,
@@ -1011,7 +1011,7 @@ impl<'hir> Map<'hir> {
10111011
Some(Node::TraitItem(ref ti)) => Some(&ti.attrs[..]),
10121012
Some(Node::ImplItem(ref ii)) => Some(&ii.attrs[..]),
10131013
Some(Node::Variant(ref v)) => Some(&v.attrs[..]),
1014-
Some(Node::Field(ref f)) => Some(&f.attrs[..]),
1014+
Some(Node::StructField(ref f)) => Some(&f.attrs[..]),
10151015
Some(Node::Expr(ref e)) => Some(&*e.attrs),
10161016
Some(Node::Stmt(ref s)) => Some(s.kind.attrs()),
10171017
Some(Node::Arm(ref a)) => Some(&*a.attrs),
@@ -1072,7 +1072,7 @@ impl<'hir> Map<'hir> {
10721072
Some(Node::TraitItem(trait_method)) => trait_method.span,
10731073
Some(Node::ImplItem(impl_item)) => impl_item.span,
10741074
Some(Node::Variant(variant)) => variant.span,
1075-
Some(Node::Field(field)) => field.span,
1075+
Some(Node::StructField(field)) => field.span,
10761076
Some(Node::AnonConst(constant)) => self.body(constant.body).value.span,
10771077
Some(Node::Expr(expr)) => expr.span,
10781078
Some(Node::Stmt(stmt)) => stmt.span,
@@ -1195,7 +1195,7 @@ impl<'a> NodesMatchingSuffix<'a> {
11951195
Some(Node::TraitItem(n)) => n.name(),
11961196
Some(Node::ImplItem(n)) => n.name(),
11971197
Some(Node::Variant(n)) => n.name(),
1198-
Some(Node::Field(n)) => n.name(),
1198+
Some(Node::StructField(n)) => n.name(),
11991199
_ => return false,
12001200
};
12011201
self.matches_names(self.map.get_parent_item(hir), name)
@@ -1304,7 +1304,7 @@ impl<'a> print::State<'a> {
13041304
Node::Lifetime(a) => self.print_lifetime(&a),
13051305
Node::Visibility(a) => self.print_visibility(&a),
13061306
Node::GenericParam(_) => bug!("cannot print Node::GenericParam"),
1307-
Node::Field(_) => bug!("cannot print StructField"),
1307+
Node::StructField(_) => bug!("cannot print StructField"),
13081308
// These cases do not carry enough information in the
13091309
// `hir_map` to reconstruct their full structure for pretty
13101310
// printing.
@@ -1392,8 +1392,8 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
13921392
variant.ident,
13931393
path_str(), id_str)
13941394
}
1395-
Some(Node::Field(ref field)) => {
1396-
format!("field {} in {}{}",
1395+
Some(Node::StructField(ref field)) => {
1396+
format!("struct field {} in {}{}",
13971397
field.ident,
13981398
path_str(), id_str)
13991399
}

src/librustc/hir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ pub enum Node<'hir> {
28142814
TraitItem(&'hir TraitItem),
28152815
ImplItem(&'hir ImplItem),
28162816
Variant(&'hir Variant),
2817-
Field(&'hir StructField),
2817+
StructField(&'hir StructField),
28182818
AnonConst(&'hir AnonConst),
28192819
Expr(&'hir Expr),
28202820
Stmt(&'hir Stmt),

src/librustc/middle/reachable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
320320
Node::ForeignItem(_) |
321321
Node::Variant(_) |
322322
Node::Ctor(..) |
323-
Node::Field(_) |
323+
Node::StructField(_) |
324324
Node::Ty(_) |
325325
Node::MacroDef(_) => {}
326326
_ => {

src/librustc_mir/borrow_check/mutability_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ fn annotate_struct_field(
627627
let node = tcx.hir().find(hir_id)?;
628628
// Now we're dealing with the actual struct that we're going to suggest a change to,
629629
// we can expect a field that is an immutable reference to a type.
630-
if let hir::Node::Field(field) = node {
630+
if let hir::Node::StructField(field) = node {
631631
if let hir::TyKind::Rptr(lifetime, hir::MutTy {
632632
mutbl: hir::Mutability::MutImmutable,
633633
ref ty

src/librustc_typeck/collect.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
902902
let node = tcx.hir().get(hir_id);
903903
let parent_def_id = match node {
904904
Node::ImplItem(_) | Node::TraitItem(_) | Node::Variant(_) |
905-
Node::Ctor(..) | Node::Field(_) => {
905+
Node::Ctor(..) | Node::StructField(_) => {
906906
let parent_id = tcx.hir().get_parent_item(hir_id);
907907
Some(tcx.hir().local_def_id(parent_id))
908908
}
@@ -1358,7 +1358,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option<Ty<
13581358
}
13591359
},
13601360

1361-
Node::Field(field) => icx.to_ty(&field.ty),
1361+
Node::StructField(field) => icx.to_ty(&field.ty),
13621362

13631363
Node::Expr(&hir::Expr {
13641364
kind: hir::ExprKind::Closure(.., gen),

0 commit comments

Comments
 (0)