Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5b0cf56

Browse files
csmoeoli-obk
authored andcommittedJul 16, 2018
ItemKind
1 parent 7e5d224 commit 5b0cf56

Some content is hidden

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

61 files changed

+696
-696
lines changed
 

‎src/librustc/hir/check_attr.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ enum Target {
3838
impl Target {
3939
fn from_item(item: &hir::Item) -> Target {
4040
match item.node {
41-
hir::ItemFn(..) => Target::Fn,
42-
hir::ItemStruct(..) => Target::Struct,
43-
hir::ItemUnion(..) => Target::Union,
44-
hir::ItemEnum(..) => Target::Enum,
45-
hir::ItemConst(..) => Target::Const,
46-
hir::ItemForeignMod(..) => Target::ForeignMod,
47-
hir::ItemStatic(..) => Target::Static,
41+
hir::ItemKind::Fn(..) => Target::Fn,
42+
hir::ItemKind::Struct(..) => Target::Struct,
43+
hir::ItemKind::Union(..) => Target::Union,
44+
hir::ItemKind::Enum(..) => Target::Enum,
45+
hir::ItemKind::Const(..) => Target::Const,
46+
hir::ItemKind::ForeignMod(..) => Target::ForeignMod,
47+
hir::ItemKind::Static(..) => Target::Static,
4848
_ => Target::Other,
4949
}
5050
}
@@ -340,7 +340,7 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
340340
}
341341

342342
fn is_c_like_enum(item: &hir::Item) -> bool {
343-
if let hir::ItemEnum(ref def, _) = item.node {
343+
if let hir::ItemKind::Enum(ref def, _) = item.node {
344344
for variant in &def.variants {
345345
match variant.node.data {
346346
hir::VariantData::Unit(_) => { /* continue */ }

‎src/librustc/hir/intravisit.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -463,23 +463,23 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
463463
visitor.visit_vis(&item.vis);
464464
visitor.visit_name(item.span, item.name);
465465
match item.node {
466-
ItemExternCrate(orig_name) => {
466+
ItemKind::ExternCrate(orig_name) => {
467467
visitor.visit_id(item.id);
468468
if let Some(orig_name) = orig_name {
469469
visitor.visit_name(item.span, orig_name);
470470
}
471471
}
472-
ItemUse(ref path, _) => {
472+
ItemKind::Use(ref path, _) => {
473473
visitor.visit_id(item.id);
474474
visitor.visit_path(path, item.id);
475475
}
476-
ItemStatic(ref typ, _, body) |
477-
ItemConst(ref typ, body) => {
476+
ItemKind::Static(ref typ, _, body) |
477+
ItemKind::Const(ref typ, body) => {
478478
visitor.visit_id(item.id);
479479
visitor.visit_ty(typ);
480480
visitor.visit_nested_body(body);
481481
}
482-
ItemFn(ref declaration, header, ref generics, body_id) => {
482+
ItemKind::Fn(ref declaration, header, ref generics, body_id) => {
483483
visitor.visit_fn(FnKind::ItemFn(item.name,
484484
generics,
485485
header,
@@ -490,55 +490,55 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) {
490490
item.span,
491491
item.id)
492492
}
493-
ItemMod(ref module) => {
493+
ItemKind::Mod(ref module) => {
494494
// visit_mod() takes care of visiting the Item's NodeId
495495
visitor.visit_mod(module, item.span, item.id)
496496
}
497-
ItemForeignMod(ref foreign_module) => {
497+
ItemKind::ForeignMod(ref foreign_module) => {
498498
visitor.visit_id(item.id);
499499
walk_list!(visitor, visit_foreign_item, &foreign_module.items);
500500
}
501-
ItemGlobalAsm(_) => {
501+
ItemKind::GlobalAsm(_) => {
502502
visitor.visit_id(item.id);
503503
}
504-
ItemTy(ref typ, ref type_parameters) => {
504+
ItemKind::Ty(ref typ, ref type_parameters) => {
505505
visitor.visit_id(item.id);
506506
visitor.visit_ty(typ);
507507
visitor.visit_generics(type_parameters)
508508
}
509-
ItemExistential(ExistTy {ref generics, ref bounds, impl_trait_fn}) => {
509+
ItemKind::Existential(ExistTy {ref generics, ref bounds, impl_trait_fn}) => {
510510
visitor.visit_id(item.id);
511511
walk_generics(visitor, generics);
512512
walk_list!(visitor, visit_param_bound, bounds);
513513
if let Some(impl_trait_fn) = impl_trait_fn {
514514
visitor.visit_def_mention(Def::Fn(impl_trait_fn))
515515
}
516516
}
517-
ItemEnum(ref enum_definition, ref type_parameters) => {
517+
ItemKind::Enum(ref enum_definition, ref type_parameters) => {
518518
visitor.visit_generics(type_parameters);
519519
// visit_enum_def() takes care of visiting the Item's NodeId
520520
visitor.visit_enum_def(enum_definition, type_parameters, item.id, item.span)
521521
}
522-
ItemImpl(.., ref type_parameters, ref opt_trait_reference, ref typ, ref impl_item_refs) => {
522+
ItemKind::Impl(.., ref type_parameters, ref opt_trait_reference, ref typ, ref impl_item_refs) => {
523523
visitor.visit_id(item.id);
524524
visitor.visit_generics(type_parameters);
525525
walk_list!(visitor, visit_trait_ref, opt_trait_reference);
526526
visitor.visit_ty(typ);
527527
walk_list!(visitor, visit_impl_item_ref, impl_item_refs);
528528
}
529-
ItemStruct(ref struct_definition, ref generics) |
530-
ItemUnion(ref struct_definition, ref generics) => {
529+
ItemKind::Struct(ref struct_definition, ref generics) |
530+
ItemKind::Union(ref struct_definition, ref generics) => {
531531
visitor.visit_generics(generics);
532532
visitor.visit_id(item.id);
533533
visitor.visit_variant_data(struct_definition, item.name, generics, item.id, item.span);
534534
}
535-
ItemTrait(.., ref generics, ref bounds, ref trait_item_refs) => {
535+
ItemKind::Trait(.., ref generics, ref bounds, ref trait_item_refs) => {
536536
visitor.visit_id(item.id);
537537
visitor.visit_generics(generics);
538538
walk_list!(visitor, visit_param_bound, bounds);
539539
walk_list!(visitor, visit_trait_item_ref, trait_item_refs);
540540
}
541-
ItemTraitAlias(ref generics, ref bounds) => {
541+
ItemKind::TraitAlias(ref generics, ref bounds) => {
542542
visitor.visit_id(item.id);
543543
visitor.visit_generics(generics);
544544
walk_list!(visitor, visit_param_bound, bounds);

0 commit comments

Comments
 (0)