Skip to content

Commit d4573c9

Browse files
committed
Rename TraitItem.node to TraitItem.kind
1 parent 17726f6 commit d4573c9

File tree

42 files changed

+82
-82
lines changed

Some content is hidden

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

42 files changed

+82
-82
lines changed

src/librustc/hir/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(visitor: &mut V, trait_item: &'v Trai
856856
visitor.visit_ident(trait_item.ident);
857857
walk_list!(visitor, visit_attribute, &trait_item.attrs);
858858
visitor.visit_generics(&trait_item.generics);
859-
match trait_item.node {
859+
match trait_item.kind {
860860
TraitItemKind::Const(ref ty, default) => {
861861
visitor.visit_id(trait_item.hir_id);
862862
visitor.visit_ty(ty);

src/librustc/hir/lowering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ impl<'a> LoweringContext<'a> {
469469
fn visit_trait_item(&mut self, item: &'tcx TraitItem) {
470470
self.lctx.allocate_hir_id_counter(item.id);
471471

472-
match item.node {
472+
match item.kind {
473473
TraitItemKind::Method(_, None) => {
474474
// Ignore patterns in trait methods without bodies
475475
self.with_hir_id_owner(None, |this| {

src/librustc/hir/lowering/item.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ impl LoweringContext<'_> {
818818
fn lower_trait_item(&mut self, i: &TraitItem) -> hir::TraitItem {
819819
let trait_item_def_id = self.resolver.definitions().local_def_id(i.id);
820820

821-
let (generics, node) = match i.node {
821+
let (generics, kind) = match i.kind {
822822
TraitItemKind::Const(ref ty, ref default) => (
823823
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
824824
hir::TraitItemKind::Const(
@@ -852,14 +852,14 @@ impl LoweringContext<'_> {
852852
}
853853
TraitItemKind::Type(ref bounds, ref default) => {
854854
let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
855-
let node = hir::TraitItemKind::Type(
855+
let kind = hir::TraitItemKind::Type(
856856
self.lower_param_bounds(bounds, ImplTraitContext::disallowed()),
857857
default
858858
.as_ref()
859859
.map(|x| self.lower_ty(x, ImplTraitContext::disallowed())),
860860
);
861861

862-
(generics, node)
862+
(generics, kind)
863863
},
864864
TraitItemKind::Macro(..) => bug!("macro item shouldn't exist at this point"),
865865
};
@@ -869,13 +869,13 @@ impl LoweringContext<'_> {
869869
ident: i.ident,
870870
attrs: self.lower_attrs(&i.attrs),
871871
generics,
872-
node,
872+
kind,
873873
span: i.span,
874874
}
875875
}
876876

877877
fn lower_trait_item_ref(&mut self, i: &TraitItem) -> hir::TraitItemRef {
878-
let (kind, has_default) = match i.node {
878+
let (kind, has_default) = match i.kind {
879879
TraitItemKind::Const(_, ref default) => {
880880
(hir::AssocItemKind::Const, default.is_some())
881881
}

src/librustc/hir/map/blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl MaybeFnLike for ast::ImplItem {
5252

5353
impl MaybeFnLike for ast::TraitItem {
5454
fn is_fn_like(&self) -> bool {
55-
match self.node {
55+
match self.kind {
5656
ast::TraitItemKind::Method(_, ast::TraitMethod::Provided(_)) => true,
5757
_ => false,
5858
}
@@ -230,7 +230,7 @@ impl<'a> FnLikeNode<'a> {
230230
}),
231231
_ => bug!("item FnLikeNode that is not fn-like"),
232232
},
233-
map::Node::TraitItem(ti) => match ti.node {
233+
map::Node::TraitItem(ti) => match ti.kind {
234234
ast::TraitItemKind::Method(ref sig, ast::TraitMethod::Provided(body)) => {
235235
method(ti.hir_id, ti.ident, sig, None, body, ti.span, &ti.attrs)
236236
}

src/librustc/hir/map/def_collector.rs

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

216216
fn visit_trait_item(&mut self, ti: &'a TraitItem) {
217-
let def_data = match ti.node {
217+
let def_data = match ti.kind {
218218
TraitItemKind::Method(..) | TraitItemKind::Const(..) =>
219219
DefPathData::ValueNs(ti.ident.as_interned_str()),
220220
TraitItemKind::Type(..) => {

src/librustc/hir/map/mod.rs

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

5959
Node::TraitItem(ref item) => {
60-
match item.node {
60+
match item.kind {
6161
TraitItemKind::Method(ref method_sig, _) => Some(&method_sig.decl),
6262
_ => None
6363
}
@@ -93,7 +93,7 @@ impl<'hir> Entry<'hir> {
9393
}
9494

9595
Node::TraitItem(item) => {
96-
match item.node {
96+
match item.kind {
9797
TraitItemKind::Const(_, Some(body)) |
9898
TraitItemKind::Method(_, TraitMethod::Provided(body)) => Some(body),
9999
_ => None
@@ -320,7 +320,7 @@ impl<'hir> Map<'hir> {
320320
}
321321
}
322322
Node::TraitItem(item) => {
323-
match item.node {
323+
match item.kind {
324324
TraitItemKind::Const(..) => DefKind::AssocConst,
325325
TraitItemKind::Method(..) => DefKind::Method,
326326
TraitItemKind::Type(..) => DefKind::AssocTy,
@@ -454,14 +454,14 @@ impl<'hir> Map<'hir> {
454454
pub fn body_owner_kind(&self, id: HirId) -> BodyOwnerKind {
455455
match self.get(id) {
456456
Node::Item(&Item { node: ItemKind::Const(..), .. }) |
457-
Node::TraitItem(&TraitItem { node: TraitItemKind::Const(..), .. }) |
457+
Node::TraitItem(&TraitItem { kind: TraitItemKind::Const(..), .. }) |
458458
Node::ImplItem(&ImplItem { kind: ImplItemKind::Const(..), .. }) |
459459
Node::AnonConst(_) => {
460460
BodyOwnerKind::Const
461461
}
462462
Node::Ctor(..) |
463463
Node::Item(&Item { node: ItemKind::Fn(..), .. }) |
464-
Node::TraitItem(&TraitItem { node: TraitItemKind::Method(..), .. }) |
464+
Node::TraitItem(&TraitItem { kind: TraitItemKind::Method(..), .. }) |
465465
Node::ImplItem(&ImplItem { kind: ImplItemKind::Method(..), .. }) => {
466466
BodyOwnerKind::Fn
467467
}
@@ -653,7 +653,7 @@ impl<'hir> Map<'hir> {
653653
..
654654
})
655655
| Node::TraitItem(&TraitItem {
656-
node: TraitItemKind::Const(..),
656+
kind: TraitItemKind::Const(..),
657657
..
658658
})
659659
| Node::ImplItem(&ImplItem {
@@ -826,7 +826,7 @@ impl<'hir> Map<'hir> {
826826
}
827827
},
828828
Node::TraitItem(ti) => {
829-
match ti.node {
829+
match ti.kind {
830830
TraitItemKind::Method(..) => true,
831831
_ => false,
832832
}
@@ -1326,7 +1326,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
13261326
}
13271327
}
13281328
Some(Node::TraitItem(ti)) => {
1329-
let kind = match ti.node {
1329+
let kind = match ti.kind {
13301330
TraitItemKind::Const(..) => "assoc constant",
13311331
TraitItemKind::Method(..) => "trait method",
13321332
TraitItemKind::Type(..) => "assoc type",

src/librustc/hir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ pub struct TraitItem {
18301830
pub hir_id: HirId,
18311831
pub attrs: HirVec<Attribute>,
18321832
pub generics: Generics,
1833-
pub node: TraitItemKind,
1833+
pub kind: TraitItemKind,
18341834
pub span: Span,
18351835
}
18361836

src/librustc/hir/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ impl<'a> State<'a> {
858858
self.hardbreak_if_not_bol();
859859
self.maybe_print_comment(ti.span.lo());
860860
self.print_outer_attributes(&ti.attrs);
861-
match ti.node {
861+
match ti.kind {
862862
hir::TraitItemKind::Const(ref ty, default) => {
863863
let vis = Spanned { span: syntax_pos::DUMMY_SP,
864864
node: hir::VisibilityKind::Inherited };

src/librustc/ich/impls_hir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,15 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::TraitItem {
200200
ident,
201201
ref attrs,
202202
ref generics,
203-
ref node,
203+
ref kind,
204204
span
205205
} = *self;
206206

207207
hcx.hash_hir_item_like(|hcx| {
208208
ident.name.hash_stable(hcx, hasher);
209209
attrs.hash_stable(hcx, hasher);
210210
generics.hash_stable(hcx, hasher);
211-
node.hash_stable(hcx, hasher);
211+
kind.hash_stable(hcx, hasher);
212212
span.hash_stable(hcx, hasher);
213213
});
214214
}

src/librustc/infer/error_reporting/mod.rs

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

262262
fn trait_item_scope_tag(item: &hir::TraitItem) -> &'static str {
263-
match item.node {
263+
match item.kind {
264264
hir::TraitItemKind::Method(..) => "method body",
265265
hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => "associated item",
266266
}

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
@@ -35,7 +35,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
3535
..
3636
}) => &fndecl,
3737
Node::TraitItem(&hir::TraitItem {
38-
node: hir::TraitItemKind::Method(ref m, ..),
38+
kind: hir::TraitItemKind::Method(ref m, ..),
3939
..
4040
})
4141
| Node::ImplItem(&hir::ImplItem {

src/librustc/middle/dead.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
384384
hir::ItemKind::Trait(.., ref trait_item_refs) => {
385385
for trait_item_ref in trait_item_refs {
386386
let trait_item = self.krate.trait_item(trait_item_ref.id);
387-
match trait_item.node {
387+
match trait_item.kind {
388388
hir::TraitItemKind::Const(_, Some(_)) |
389389
hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(_)) => {
390390
if has_allow_dead_code_or_lang_attr(self.tcx,
@@ -652,7 +652,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> {
652652

653653
// Overwrite so that we don't warn the trait item itself.
654654
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
655-
match trait_item.node {
655+
match trait_item.kind {
656656
hir::TraitItemKind::Const(_, Some(body_id)) |
657657
hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(body_id)) => {
658658
self.visit_nested_body(body_id)

src/librustc/middle/reachable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
164164
}
165165
}
166166
Some(Node::TraitItem(trait_method)) => {
167-
match trait_method.node {
167+
match trait_method.kind {
168168
hir::TraitItemKind::Const(_, ref default) => default.is_some(),
169169
hir::TraitItemKind::Method(_, hir::TraitMethod::Provided(_)) => true,
170170
hir::TraitItemKind::Method(_, hir::TraitMethod::Required(_)) |
@@ -286,7 +286,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
286286
}
287287
}
288288
Node::TraitItem(trait_method) => {
289-
match trait_method.node {
289+
match trait_method.kind {
290290
hir::TraitItemKind::Const(_, None) |
291291
hir::TraitItemKind::Method(_, hir::TraitMethod::Required(_)) => {
292292
// Keep going, nothing to get exported

src/librustc/middle/resolve_lifetime.rs

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

779779
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem) {
780780
use self::hir::TraitItemKind::*;
781-
match trait_item.node {
781+
match trait_item.kind {
782782
Method(ref sig, _) => {
783783
let tcx = self.tcx;
784784
self.visit_early_late(
@@ -1871,7 +1871,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
18711871
..
18721872
})
18731873
| Node::TraitItem(&hir::TraitItem {
1874-
node: hir::TraitItemKind::Method(..),
1874+
kind: hir::TraitItemKind::Method(..),
18751875
..
18761876
})
18771877
| Node::ImplItem(&hir::ImplItem {
@@ -2170,7 +2170,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> {
21702170
}) => Some(body),
21712171

21722172
Node::TraitItem(&hir::TraitItem {
2173-
node: hir::TraitItemKind::Method(_, ref m),
2173+
kind: hir::TraitItemKind::Method(_, ref m),
21742174
..
21752175
}) => {
21762176
if let hir::ItemKind::Trait(.., ref trait_items) = self.tcx

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11731173
}) |
11741174
Node::TraitItem(&hir::TraitItem {
11751175
span,
1176-
node: hir::TraitItemKind::Method(hir::MethodSig { ref decl, .. }, _),
1176+
kind: hir::TraitItemKind::Method(hir::MethodSig { ref decl, .. }, _),
11771177
..
11781178
}) => {
11791179
(self.tcx.sess.source_map().def_span(span), decl.inputs.iter()

src/librustc_incremental/persist/dirty_clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl DirtyCleanVisitor<'tcx> {
397397
}
398398
},
399399
HirNode::TraitItem(item) => {
400-
match item.node {
400+
match item.kind {
401401
TraitItemKind::Method(..) => ("Node::TraitItem", LABELS_FN_IN_TRAIT),
402402
TraitItemKind::Const(..) => ("NodeTraitConst", LABELS_CONST_IN_TRAIT),
403403
TraitItemKind::Type(..) => ("NodeTraitType", LABELS_CONST_IN_TRAIT),

src/librustc_interface/util.rs

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

798798
fn flat_map_trait_item(&mut self, i: ast::TraitItem) -> SmallVec<[ast::TraitItem; 1]> {
799-
let is_const = match i.node {
799+
let is_const = match i.kind {
800800
ast::TraitItemKind::Const(..) => true,
801801
ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
802802
header.constness.node == ast::Constness::Const || Self::should_ignore_fn(decl),

src/librustc_lint/builtin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ impl EarlyLintPass for UnsafeCode {
268268
}
269269

270270
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, item: &ast::TraitItem) {
271-
if let ast::TraitItemKind::Method(ref sig, None) = item.node {
271+
if let ast::TraitItemKind::Method(ref sig, None) = item.kind {
272272
if sig.header.unsafety == ast::Unsafety::Unsafe {
273273
self.report_unsafe(cx, item.span, "declaration of an `unsafe` method")
274274
}
@@ -440,7 +440,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc {
440440
return;
441441
}
442442

443-
let desc = match trait_item.node {
443+
let desc = match trait_item.kind {
444444
hir::TraitItemKind::Const(..) => "an associated constant",
445445
hir::TraitItemKind::Method(..) => "a trait method",
446446
hir::TraitItemKind::Type(..) => "an associated type",
@@ -611,7 +611,7 @@ declare_lint_pass!(
611611

612612
impl EarlyLintPass for AnonymousParameters {
613613
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::TraitItem) {
614-
match it.node {
614+
match it.kind {
615615
ast::TraitItemKind::Method(ref sig, _) => {
616616
for arg in sig.decl.inputs.iter() {
617617
match arg.pat.kind {

src/librustc_lint/nonstandard_style.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
332332
}
333333

334334
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::TraitItem) {
335-
if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = &item.node {
335+
if let hir::TraitItemKind::Method(_, hir::TraitMethod::Required(pnames)) = &item.kind {
336336
self.check_snake_case(cx, "trait method", &item.ident);
337337
for param_name in pnames {
338338
self.check_snake_case(cx, "variable", param_name);
@@ -399,7 +399,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonUpperCaseGlobals {
399399
}
400400

401401
fn check_trait_item(&mut self, cx: &LateContext<'_, '_>, ti: &hir::TraitItem) {
402-
if let hir::TraitItemKind::Const(..) = ti.node {
402+
if let hir::TraitItemKind::Const(..) = ti.kind {
403403
NonUpperCaseGlobals::check_upper_case(cx, "associated constant", &ti.ident);
404404
}
405405
}

src/librustc_metadata/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ impl EncodeContext<'tcx> {
862862
let kind = match trait_item.kind {
863863
ty::AssocKind::Const => {
864864
let const_qualif =
865-
if let hir::TraitItemKind::Const(_, Some(body)) = ast_item.node {
865+
if let hir::TraitItemKind::Const(_, Some(body)) = ast_item.kind {
866866
self.const_qualif(0, body)
867867
} else {
868868
ConstQualif { mir: 0, ast_promotable: false }
@@ -875,7 +875,7 @@ impl EncodeContext<'tcx> {
875875
EntryKind::AssocConst(container, const_qualif, rendered_const)
876876
}
877877
ty::AssocKind::Method => {
878-
let fn_data = if let hir::TraitItemKind::Method(method_sig, m) = &ast_item.node {
878+
let fn_data = if let hir::TraitItemKind::Method(method_sig, m) = &ast_item.kind {
879879
let param_names = match *m {
880880
hir::TraitMethod::Required(ref names) => {
881881
self.encode_fn_param_names(names)

src/librustc_mir/build/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
3737
)
3838
| Node::TraitItem(
3939
hir::TraitItem {
40-
node: hir::TraitItemKind::Method(
40+
kind: hir::TraitItemKind::Method(
4141
hir::MethodSig { decl, .. },
4242
hir::TraitMethod::Provided(body_id),
4343
),
@@ -50,7 +50,7 @@ pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
5050
| Node::Item(hir::Item { node: hir::ItemKind::Const(ty, body_id), .. })
5151
| Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(ty, body_id), .. })
5252
| Node::TraitItem(
53-
hir::TraitItem { node: hir::TraitItemKind::Const(ty, Some(body_id)), .. }
53+
hir::TraitItem { kind: hir::TraitItemKind::Const(ty, Some(body_id)), .. }
5454
) => {
5555
(*body_id, ty.span)
5656
}

src/librustc_passes/ast_validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
628628
}
629629
self.no_questions_in_bounds(bounds, "supertraits", true);
630630
for trait_item in trait_items {
631-
if let TraitItemKind::Method(ref sig, ref block) = trait_item.node {
631+
if let TraitItemKind::Method(ref sig, ref block) = trait_item.kind {
632632
self.check_fn_decl(&sig.decl);
633633
self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness.node);
634634
self.check_trait_fn_not_const(sig.header.constness);

0 commit comments

Comments
 (0)