Skip to content

Commit ce6aabb

Browse files
committed
Rename ImplItem.node to ImplItem.kind
1 parent 8bd0382 commit ce6aabb

File tree

48 files changed

+107
-108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+107
-108
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
905905
ref defaultness,
906906
ref attrs,
907907
ref generics,
908-
ref node,
908+
ref kind,
909909
span: _,
910910
} = *impl_item;
911911

@@ -914,7 +914,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
914914
visitor.visit_defaultness(defaultness);
915915
walk_list!(visitor, visit_attribute, attrs);
916916
visitor.visit_generics(generics);
917-
match *node {
917+
match *kind {
918918
ImplItemKind::Const(ref ty, body) => {
919919
visitor.visit_id(impl_item.hir_id);
920920
visitor.visit_ty(ty);

src/librustc/hir/lowering/item.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ impl LoweringContext<'_> {
902902
fn lower_impl_item(&mut self, i: &ImplItem) -> hir::ImplItem {
903903
let impl_item_def_id = self.resolver.definitions().local_def_id(i.id);
904904

905-
let (generics, node) = match i.node {
905+
let (generics, kind) = match i.kind {
906906
ImplItemKind::Const(ref ty, ref expr) => (
907907
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
908908
hir::ImplItemKind::Const(
@@ -946,7 +946,7 @@ impl LoweringContext<'_> {
946946
generics,
947947
vis: self.lower_visibility(&i.vis, None),
948948
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
949-
node,
949+
kind,
950950
span: i.span,
951951
}
952952

@@ -960,7 +960,7 @@ impl LoweringContext<'_> {
960960
span: i.span,
961961
vis: self.lower_visibility(&i.vis, Some(i.id)),
962962
defaultness: self.lower_defaultness(i.defaultness, true /* [1] */),
963-
kind: match i.node {
963+
kind: match i.kind {
964964
ImplItemKind::Const(..) => hir::AssocItemKind::Const,
965965
ImplItemKind::TyAlias(..) => hir::AssocItemKind::Type,
966966
ImplItemKind::OpaqueTy(..) => hir::AssocItemKind::OpaqueTy,

src/librustc/hir/map/blocks.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ impl MaybeFnLike for ast::Item {
4343

4444
impl MaybeFnLike for ast::ImplItem {
4545
fn is_fn_like(&self) -> bool {
46-
match self.node { ast::ImplItemKind::Method(..) => true, _ => false, }
46+
match self.kind {
47+
ast::ImplItemKind::Method(..) => true,
48+
_ => false,
49+
}
4750
}
4851
}
4952

@@ -234,7 +237,7 @@ impl<'a> FnLikeNode<'a> {
234237
_ => bug!("trait method FnLikeNode that is not fn-like"),
235238
},
236239
map::Node::ImplItem(ii) => {
237-
match ii.node {
240+
match ii.kind {
238241
ast::ImplItemKind::Method(ref sig, body) => {
239242
method(ii.hir_id, ii.ident, sig, Some(&ii.vis), body, ii.span, &ii.attrs)
240243
}

src/librustc/hir/map/def_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
228228
}
229229

230230
fn visit_impl_item(&mut self, ii: &'a ImplItem) {
231-
let def_data = match ii.node {
231+
let def_data = match ii.kind {
232232
ImplItemKind::Method(MethodSig {
233233
ref header,
234234
ref decl,

src/librustc/hir/map/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'hir> Entry<'hir> {
6464
}
6565

6666
Node::ImplItem(ref item) => {
67-
match item.node {
67+
match item.kind {
6868
ImplItemKind::Method(ref method_sig, _) => Some(&method_sig.decl),
6969
_ => None,
7070
}
@@ -101,7 +101,7 @@ impl<'hir> Entry<'hir> {
101101
}
102102

103103
Node::ImplItem(item) => {
104-
match item.node {
104+
match item.kind {
105105
ImplItemKind::Const(_, body) |
106106
ImplItemKind::Method(_, body) => Some(body),
107107
_ => None,
@@ -327,7 +327,7 @@ impl<'hir> Map<'hir> {
327327
}
328328
}
329329
Node::ImplItem(item) => {
330-
match item.node {
330+
match item.kind {
331331
ImplItemKind::Const(..) => DefKind::AssocConst,
332332
ImplItemKind::Method(..) => DefKind::Method,
333333
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
@@ -455,14 +455,14 @@ impl<'hir> Map<'hir> {
455455
match self.get(id) {
456456
Node::Item(&Item { node: ItemKind::Const(..), .. }) |
457457
Node::TraitItem(&TraitItem { node: TraitItemKind::Const(..), .. }) |
458-
Node::ImplItem(&ImplItem { node: ImplItemKind::Const(..), .. }) |
458+
Node::ImplItem(&ImplItem { kind: ImplItemKind::Const(..), .. }) |
459459
Node::AnonConst(_) => {
460460
BodyOwnerKind::Const
461461
}
462462
Node::Ctor(..) |
463463
Node::Item(&Item { node: ItemKind::Fn(..), .. }) |
464464
Node::TraitItem(&TraitItem { node: TraitItemKind::Method(..), .. }) |
465-
Node::ImplItem(&ImplItem { node: ImplItemKind::Method(..), .. }) => {
465+
Node::ImplItem(&ImplItem { kind: ImplItemKind::Method(..), .. }) => {
466466
BodyOwnerKind::Fn
467467
}
468468
Node::Item(&Item { node: ItemKind::Static(_, m, _), .. }) => {
@@ -657,7 +657,7 @@ impl<'hir> Map<'hir> {
657657
..
658658
})
659659
| Node::ImplItem(&ImplItem {
660-
node: ImplItemKind::Const(..),
660+
kind: ImplItemKind::Const(..),
661661
..
662662
})
663663
| Node::AnonConst(_)
@@ -832,7 +832,7 @@ impl<'hir> Map<'hir> {
832832
}
833833
},
834834
Node::ImplItem(ii) => {
835-
match ii.node {
835+
match ii.kind {
836836
ImplItemKind::Method(..) => true,
837837
_ => false,
838838
}
@@ -1310,7 +1310,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
13101310
format!("foreign item {}{}", path_str(), id_str)
13111311
}
13121312
Some(Node::ImplItem(ii)) => {
1313-
match ii.node {
1313+
match ii.kind {
13141314
ImplItemKind::Const(..) => {
13151315
format!("assoc const {} in {}{}", ii.ident, path_str(), id_str)
13161316
}

src/librustc/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1873,7 +1873,7 @@ pub struct ImplItem {
18731873
pub defaultness: Defaultness,
18741874
pub attrs: HirVec<Attribute>,
18751875
pub generics: Generics,
1876-
pub node: ImplItemKind,
1876+
pub kind: ImplItemKind,
18771877
pub span: Span,
18781878
}
18791879

src/librustc/hir/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ impl<'a> State<'a> {
896896
self.print_outer_attributes(&ii.attrs);
897897
self.print_defaultness(ii.defaultness);
898898

899-
match ii.node {
899+
match ii.kind {
900900
hir::ImplItemKind::Const(ref ty, expr) => {
901901
self.print_associated_const(ii.ident, &ty, Some(expr), &ii.vis);
902902
}

src/librustc/ich/impls_hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
226226
defaultness,
227227
ref attrs,
228228
ref generics,
229-
ref node,
229+
ref kind,
230230
span
231231
} = *self;
232232

@@ -236,7 +236,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::ImplItem {
236236
defaultness.hash_stable(hcx, hasher);
237237
attrs.hash_stable(hcx, hasher);
238238
generics.hash_stable(hcx, hasher);
239-
node.hash_stable(hcx, hasher);
239+
kind.hash_stable(hcx, hasher);
240240
span.hash_stable(hcx, hasher);
241241
});
242242
}

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl<'tcx> TyCtxt<'tcx> {
267267
}
268268

269269
fn impl_item_scope_tag(item: &hir::ImplItem) -> &'static str {
270-
match item.node {
270+
match item.kind {
271271
hir::ImplItemKind::Method(..) => "method body",
272272
hir::ImplItemKind::Const(..)
273273
| hir::ImplItemKind::OpaqueTy(..)

src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
3939
..
4040
})
4141
| Node::ImplItem(&hir::ImplItem {
42-
node: hir::ImplItemKind::Method(ref m, ..),
42+
kind: hir::ImplItemKind::Method(ref m, ..),
4343
..
4444
}) => &m.decl,
4545
_ => return None,

src/librustc/infer/opaque_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ impl<'a, 'tcx> Instantiator<'a, 'tcx> {
10601060
(def_scope_default(), hir::OpaqueTyOrigin::TypeAlias)
10611061
}
10621062
},
1063-
Some(Node::ImplItem(item)) => match item.node {
1063+
Some(Node::ImplItem(item)) => match item.kind {
10641064
hir::ImplItemKind::OpaqueTy(_) => (
10651065
may_define_opaque_type(
10661066
tcx,

src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
626626
}
627627

628628
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
629-
match impl_item.node {
629+
match impl_item.kind {
630630
hir::ImplItemKind::Const(_, body_id) => {
631631
if !self.symbol_is_live(impl_item.hir_id) {
632632
self.warn_dead_code(impl_item.hir_id,

src/librustc/middle/reachable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn method_might_be_inlined(
5555
if codegen_fn_attrs.requests_inline() || generics.requires_monomorphization(tcx) {
5656
return true
5757
}
58-
if let hir::ImplItemKind::Method(method_sig, _) = &impl_item.node {
58+
if let hir::ImplItemKind::Method(method_sig, _) = &impl_item.kind {
5959
if method_sig.header.is_const() {
6060
return true
6161
}
@@ -172,7 +172,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
172172
}
173173
}
174174
Some(Node::ImplItem(impl_item)) => {
175-
match impl_item.node {
175+
match impl_item.kind {
176176
hir::ImplItemKind::Const(..) => true,
177177
hir::ImplItemKind::Method(..) => {
178178
let attrs = self.tcx.codegen_fn_attrs(def_id);
@@ -299,7 +299,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
299299
}
300300
}
301301
Node::ImplItem(impl_item) => {
302-
match impl_item.node {
302+
match impl_item.kind {
303303
hir::ImplItemKind::Const(_, body) => {
304304
self.visit_nested_body(body);
305305
}

src/librustc/middle/resolve_lifetime.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
830830

831831
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem) {
832832
use self::hir::ImplItemKind::*;
833-
match impl_item.node {
833+
match impl_item.kind {
834834
Method(ref sig, _) => {
835835
let tcx = self.tcx;
836836
self.visit_early_late(
@@ -1530,7 +1530,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
15301530
}
15311531
},
15321532
Node::ImplItem(impl_item) => {
1533-
if let hir::ImplItemKind::Method(sig, _) = &impl_item.node {
1533+
if let hir::ImplItemKind::Method(sig, _) = &impl_item.kind {
15341534
find_arg_use_span(&sig.decl.inputs);
15351535
}
15361536
}
@@ -1875,7 +1875,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
18751875
..
18761876
})
18771877
| Node::ImplItem(&hir::ImplItem {
1878-
node: hir::ImplItemKind::Method(..),
1878+
kind: hir::ImplItemKind::Method(..),
18791879
..
18801880
}) => {
18811881
let scope = self.tcx.hir().local_def_id(fn_id);
@@ -2190,7 +2190,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
21902190
}
21912191

21922192
Node::ImplItem(&hir::ImplItem {
2193-
node: hir::ImplItemKind::Method(_, body),
2193+
kind: hir::ImplItemKind::Method(_, body),
21942194
..
21952195
}) => {
21962196
if let hir::ItemKind::Impl(.., ref self_ty, ref impl_items) = self.tcx

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11681168
}) |
11691169
Node::ImplItem(&hir::ImplItem {
11701170
span,
1171-
node: hir::ImplItemKind::Method(hir::MethodSig { ref decl, .. }, _),
1171+
kind: hir::ImplItemKind::Method(hir::MethodSig { ref decl, .. }, _),
11721172
..
11731173
}) |
11741174
Node::TraitItem(&hir::TraitItem {

src/librustc_codegen_ssa/back/symbol_export.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ fn reachable_non_generics_provider(
101101
node: hir::ItemKind::Fn(..), ..
102102
}) |
103103
Node::ImplItem(&hir::ImplItem {
104-
node: hir::ImplItemKind::Method(..),
104+
kind: hir::ImplItemKind::Method(..),
105105
..
106106
}) => {
107107
let def_id = tcx.hir().local_def_id(hir_id);

src/librustc_incremental/persist/dirty_clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ impl DirtyCleanVisitor<'tcx> {
404404
}
405405
},
406406
HirNode::ImplItem(item) => {
407-
match item.node {
407+
match item.kind {
408408
ImplItemKind::Method(..) => ("Node::ImplItem", LABELS_FN_IN_IMPL),
409409
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL),
410410
ImplItemKind::TyAlias(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),

src/librustc_interface/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ impl<'a> MutVisitor for ReplaceBodyWithLoop<'a> {
806806
}
807807

808808
fn flat_map_impl_item(&mut self, i: ast::ImplItem) -> SmallVec<[ast::ImplItem; 1]> {
809-
let is_const = match i.node {
809+
let is_const = match i.kind {
810810
ast::ImplItemKind::Const(..) => true,
811811
ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
812812
header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
459459
return;
460460
}
461461

462-
let desc = match impl_item.node {
462+
let desc = match impl_item.kind {
463463
hir::ImplItemKind::Const(..) => "an associated constant",
464464
hir::ImplItemKind::Method(..) => "a method",
465465
hir::ImplItemKind::TyAlias(_) => "an associated type",

src/librustc_lint/nonstandard_style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
405405
}
406406

407407
fn check_impl_item(&mut self, cx: &LateContext<'_, '_>, ii: &hir::ImplItem) {
408-
if let hir::ImplItemKind::Const(..) = ii.node {
408+
if let hir::ImplItemKind::Const(..) = ii.kind {
409409
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ii.ident);
410410
}
411411
}

src/librustc_metadata/encoder.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ impl EncodeContext<'tcx> {
970970

971971
let kind = match impl_item.kind {
972972
ty::AssocKind::Const => {
973-
if let hir::ImplItemKind::Const(_, body_id) = ast_item.node {
973+
if let hir::ImplItemKind::Const(_, body_id) = ast_item.kind {
974974
let mir = self.tcx.at(ast_item.span).mir_const_qualif(def_id).0;
975975

976976
EntryKind::AssocConst(container,
@@ -981,7 +981,7 @@ impl EncodeContext<'tcx> {
981981
}
982982
}
983983
ty::AssocKind::Method => {
984-
let fn_data = if let hir::ImplItemKind::Method(ref sig, body) = ast_item.node {
984+
let fn_data = if let hir::ImplItemKind::Method(ref sig, body) = ast_item.kind {
985985
FnData {
986986
asyncness: sig.header.asyncness,
987987
constness: sig.header.constness,
@@ -1001,21 +1001,20 @@ impl EncodeContext<'tcx> {
10011001
ty::AssocKind::Type => EntryKind::AssocType(container)
10021002
};
10031003

1004-
let mir =
1005-
match ast_item.node {
1006-
hir::ImplItemKind::Const(..) => true,
1007-
hir::ImplItemKind::Method(ref sig, _) => {
1008-
let generics = self.tcx.generics_of(def_id);
1009-
let needs_inline = (generics.requires_monomorphization(self.tcx) ||
1010-
tcx.codegen_fn_attrs(def_id).requests_inline()) &&
1011-
!self.metadata_output_only();
1012-
let is_const_fn = sig.header.constness == hir::Constness::Const;
1013-
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
1014-
needs_inline || is_const_fn || always_encode_mir
1015-
},
1016-
hir::ImplItemKind::OpaqueTy(..) |
1017-
hir::ImplItemKind::TyAlias(..) => false,
1018-
};
1004+
let mir = match ast_item.kind {
1005+
hir::ImplItemKind::Const(..) => true,
1006+
hir::ImplItemKind::Method(ref sig, _) => {
1007+
let generics = self.tcx.generics_of(def_id);
1008+
let needs_inline = (generics.requires_monomorphization(self.tcx) ||
1009+
tcx.codegen_fn_attrs(def_id).requests_inline()) &&
1010+
!self.metadata_output_only();
1011+
let is_const_fn = sig.header.constness == hir::Constness::Const;
1012+
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
1013+
needs_inline || is_const_fn || always_encode_mir
1014+
},
1015+
hir::ImplItemKind::OpaqueTy(..) |
1016+
hir::ImplItemKind::TyAlias(..) => false,
1017+
};
10191018

10201019
Entry {
10211020
kind,

src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
772772
},
773773
),
774774
hir::Node::ImplItem(hir::ImplItem {
775-
node: hir::ImplItemKind::Method(method_sig, _),
775+
kind: hir::ImplItemKind::Method(method_sig, _),
776776
..
777777
}) => (method_sig.decl.output.span(), ""),
778778
_ => (body.span, ""),

0 commit comments

Comments
 (0)