From b4748679611c97c09cfb7096917d7830c410a4ad Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 26 Sep 2019 17:58:14 +0100 Subject: [PATCH] Rename `ForeignItem.node` to `ForeignItem.kind` --- src/librustc/hir/intravisit.rs | 2 +- src/librustc/hir/lowering/item.rs | 2 +- src/librustc/hir/map/def_collector.rs | 2 +- src/librustc/hir/map/mod.rs | 4 ++-- src/librustc/hir/mod.rs | 2 +- src/librustc/hir/print.rs | 2 +- src/librustc/middle/dead.rs | 2 +- src/librustc/middle/resolve_lifetime.rs | 2 +- src/librustc/middle/stability.rs | 2 +- src/librustc_codegen_llvm/consts.rs | 2 +- src/librustc_lint/types.rs | 2 +- src/librustc_metadata/encoder.rs | 4 ++-- src/librustc_passes/ast_validation.rs | 2 +- src/librustc_resolve/build_reduced_graph.rs | 4 ++-- src/librustc_resolve/late.rs | 2 +- src/librustc_save_analysis/dump_visitor.rs | 2 +- src/librustc_save_analysis/lib.rs | 2 +- src/librustc_save_analysis/sig.rs | 2 +- src/librustc_traits/lowering/environment.rs | 2 +- src/librustc_typeck/check/intrinsic.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 4 ++-- src/librustc_typeck/check/wfcheck.rs | 2 +- src/librustc_typeck/collect.rs | 16 ++++++++-------- src/librustc_typeck/variance/constraints.rs | 2 +- src/librustc_typeck/variance/mod.rs | 2 +- src/librustc_typeck/variance/terms.rs | 2 +- src/librustdoc/visit_ast.rs | 2 +- src/libsyntax/ast.rs | 2 +- src/libsyntax/ext/expand.rs | 2 +- src/libsyntax/ext/placeholders.rs | 4 ++-- src/libsyntax/feature_gate/check.rs | 2 +- src/libsyntax/mut_visit.rs | 4 ++-- src/libsyntax/parse/parser/item.rs | 8 ++++---- src/libsyntax/print/pprust.rs | 2 +- src/libsyntax/visit.rs | 2 +- 35 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 3f6c7f22f16..d1ebdd2f086 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -743,7 +743,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, foreign_item: &'v visitor.visit_vis(&foreign_item.vis); visitor.visit_ident(foreign_item.ident); - match foreign_item.node { + match foreign_item.kind { ForeignItemKind::Fn(ref function_declaration, ref param_names, ref generics) => { visitor.visit_generics(generics); visitor.visit_fn_decl(function_declaration); diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs index ab477d6e1c1..7159db736a7 100644 --- a/src/librustc/hir/lowering/item.rs +++ b/src/librustc/hir/lowering/item.rs @@ -711,7 +711,7 @@ impl LoweringContext<'_> { hir_id: self.lower_node_id(i.id), ident: i.ident, attrs: self.lower_attrs(&i.attrs), - node: match i.node { + kind: match i.kind { ForeignItemKind::Fn(ref fdec, ref generics) => { let (generics, (fn_dec, fn_args)) = self.add_in_band_defs( generics, diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 4235da76f53..1997e2aab35 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -157,7 +157,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { } fn visit_foreign_item(&mut self, foreign_item: &'a ForeignItem) { - if let ForeignItemKind::Macro(_) = foreign_item.node { + if let ForeignItemKind::Macro(_) = foreign_item.kind { return self.visit_macro_invoc(foreign_item.id); } diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index c13bb3cb1f2..d4efe0297b6 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -313,7 +313,7 @@ impl<'hir> Map<'hir> { } } Node::ForeignItem(item) => { - match item.node { + match item.kind { ForeignItemKind::Fn(..) => DefKind::Fn, ForeignItemKind::Static(..) => DefKind::Static, ForeignItemKind::Type => DefKind::ForeignTy, @@ -820,7 +820,7 @@ impl<'hir> Map<'hir> { } }, Node::ForeignItem(fi) => { - match fi.node { + match fi.kind { ForeignItemKind::Fn(..) => true, _ => false, } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index abb4a88d04c..01cb5cc9bc1 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -2581,7 +2581,7 @@ pub struct ForeignItem { #[stable_hasher(project(name))] pub ident: Ident, pub attrs: HirVec, - pub node: ForeignItemKind, + pub kind: ForeignItemKind, pub hir_id: HirId, pub span: Span, pub vis: Visibility, diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index de9a458c06f..91f2c5a0aaf 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -372,7 +372,7 @@ impl<'a> State<'a> { self.hardbreak_if_not_bol(); self.maybe_print_comment(item.span.lo()); self.print_outer_attributes(&item.attrs); - match item.node { + match item.kind { hir::ForeignItemKind::Fn(ref decl, ref arg_names, ref generics) => { self.head(""); self.print_fn(decl, diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 845f214106b..7c75a1447e2 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -613,7 +613,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> { fn visit_foreign_item(&mut self, fi: &'tcx hir::ForeignItem) { if self.should_warn_about_foreign_item(fi) { self.warn_dead_code(fi.hir_id, fi.span, fi.ident.name, - fi.node.descriptive_variant(), "used"); + fi.kind.descriptive_variant(), "used"); } intravisit::walk_foreign_item(self, fi); } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 8340df4fecf..94a85a97d36 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -541,7 +541,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { } fn visit_foreign_item(&mut self, item: &'tcx hir::ForeignItem) { - match item.node { + match item.kind { hir::ForeignItemKind::Fn(ref decl, _, ref generics) => { self.visit_early_late(None, decl, generics, |this| { intravisit::walk_foreign_item(this, item); diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 0e4bab6eaf2..9e053ce4e69 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -382,7 +382,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem) { - self.check_missing_stability(i.hir_id, i.span, i.node.descriptive_variant()); + self.check_missing_stability(i.hir_id, i.span, i.kind.descriptive_variant()); intravisit::walk_foreign_item(self, i); } diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index ccecacd6205..cba5ee3260c 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -249,7 +249,7 @@ impl CodegenCx<'ll, 'tcx> { } Node::ForeignItem(&hir::ForeignItem { - ref attrs, span, node: hir::ForeignItemKind::Static(..), .. + ref attrs, span, kind: hir::ForeignItemKind::Static(..), .. }) => { let fn_attrs = self.tcx.codegen_fn_attrs(def_id); (check_and_apply_linkage(&self, &fn_attrs, ty, sym, span), attrs) diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 1fb377c9ad6..e4567dc8265 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -978,7 +978,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { if let Abi::Rust | Abi::RustCall | Abi::RustIntrinsic | Abi::PlatformIntrinsic = abi { // Don't worry about types in internal ABIs. } else { - match it.node { + match it.kind { hir::ForeignItemKind::Fn(ref decl, _, _) => { vis.check_foreign_fn(it.hir_id, decl); } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index b89da65d098..0bb4f52be14 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1677,7 +1677,7 @@ impl EncodeContext<'tcx> { debug!("EncodeContext::encode_info_for_foreign_item({:?})", def_id); - let kind = match nitem.node { + let kind = match nitem.kind { hir::ForeignItemKind::Fn(_, ref names, _) => { let data = FnData { asyncness: hir::IsAsync::NotAsync, @@ -1703,7 +1703,7 @@ impl EncodeContext<'tcx> { ty: Some(self.encode_item_type(def_id)), inherent_impls: Lazy::empty(), - variances: match nitem.node { + variances: match nitem.kind { hir::ForeignItemKind::Fn(..) => self.encode_variances_of(def_id), _ => Lazy::empty(), }, diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 89497641c10..0339b85ca55 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -682,7 +682,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } fn visit_foreign_item(&mut self, fi: &'a ForeignItem) { - match fi.node { + match fi.kind { ForeignItemKind::Fn(ref decl, _) => { self.check_fn_decl(decl); self.check_decl_no_pat(decl, |span, _| { diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index f1564c30018..9f0337f21c1 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -813,7 +813,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { /// Constructs the reduced graph for one foreign item. fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem) { - let (res, ns) = match item.node { + let (res, ns) = match item.kind { ForeignItemKind::Fn(..) => { (Res::Def(DefKind::Fn, self.r.definitions.local_def_id(item.id)), ValueNS) } @@ -1169,7 +1169,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> { } fn visit_foreign_item(&mut self, foreign_item: &'b ForeignItem) { - if let ForeignItemKind::Macro(_) = foreign_item.node { + if let ForeignItemKind::Macro(_) = foreign_item.kind { self.visit_invoc(foreign_item.id); return; } diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index e02cba6fbfd..33a85c6c770 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -406,7 +406,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> { visit::walk_poly_trait_ref(self, tref, m); } fn visit_foreign_item(&mut self, foreign_item: &'tcx ForeignItem) { - let generic_params = match foreign_item.node { + let generic_params = match foreign_item.kind { ForeignItemKind::Fn(_, ref generics) => { HasGenericParams(generics, ItemRibKind) } diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index d81d24e3a1b..edd2db3c8f7 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -1570,7 +1570,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { let hir_id = self.tcx.hir().node_to_hir_id(item.id); let access = access_from!(self.save_ctxt, item, hir_id); - match item.node { + match item.kind { ast::ForeignItemKind::Fn(ref decl, ref generics) => { if let Some(fn_data) = self.save_ctxt.get_extern_item_data(item) { down_cast_data!(fn_data, DefData, item.span); diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 20cf7949fec..e3c898610cd 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -130,7 +130,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { pub fn get_extern_item_data(&self, item: &ast::ForeignItem) -> Option { let qualname = format!("::{}", self.tcx.def_path_str(self.tcx.hir().local_def_id_from_node_id(item.id))); - match item.node { + match item.kind { ast::ForeignItemKind::Fn(ref decl, ref generics) => { filter!(self.span_utils, item.ident.span); diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index 8a0c9069224..203bd4d4167 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -765,7 +765,7 @@ impl Sig for ast::Variant { impl Sig for ast::ForeignItem { fn make(&self, offset: usize, _parent_id: Option, scx: &SaveContext<'_, '_>) -> Result { let id = Some(self.id); - match self.node { + match self.kind { ast::ForeignItemKind::Fn(ref decl, ref generics) => { let mut text = String::new(); text.push_str("fn "); diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index f923f51529a..a2fbf8128b5 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -212,7 +212,7 @@ crate fn environment(tcx: TyCtxt<'_>, def_id: DefId) -> Environment<'_> { _ => NodeKind::Other, } - Node::ForeignItem(item) => match item.node { + Node::ForeignItem(item) => match item.kind { ForeignItemKind::Fn(..) => NodeKind::Fn, _ => NodeKind::Other, } diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index dfbf8bcd0f6..d06d51dc819 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -24,7 +24,7 @@ fn equate_intrinsic_type<'tcx>( ) { let def_id = tcx.hir().local_def_id(it.hir_id); - match it.node { + match it.kind { hir::ForeignItemKind::Fn(..) => {} _ => { struct_span_err!(tcx.sess, it.span, E0622, @@ -37,7 +37,7 @@ fn equate_intrinsic_type<'tcx>( let i_n_tps = tcx.generics_of(def_id).own_counts().types; if i_n_tps != n_tps { - let span = match it.node { + let span = match it.kind { hir::ForeignItemKind::Fn(_, _, ref generics) => generics.span, _ => bug!() }; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 15c98432cc2..9f2c991fdd2 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1588,7 +1588,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, it: &'tcx hir::Item) { ).emit(); } - if let hir::ForeignItemKind::Fn(ref fn_decl, _, _) = item.node { + if let hir::ForeignItemKind::Fn(ref fn_decl, _, _) = item.kind { require_c_abi_if_c_variadic(tcx, fn_decl, m.abi, item.span); } } @@ -4242,7 +4242,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } Some(Node::ForeignItem(hir::ForeignItem { - node: hir::ForeignItemKind::Fn(_, idents, _), + kind: hir::ForeignItemKind::Fn(_, idents, _), .. })) | Some(Node::TraitItem(hir::TraitItem { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index d5577778950..f4ba9fc03d3 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -128,7 +128,7 @@ pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) { check_item_type(tcx, item.hir_id, ty.span, false); } hir::ItemKind::ForeignMod(ref module) => for it in module.items.iter() { - if let hir::ForeignItemKind::Static(ref ty, ..) = it.node { + if let hir::ForeignItemKind::Static(ref ty, ..) = it.kind { check_item_type(tcx, it.hir_id, ty.span, true); } }, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 28c275e2d75..1e642a8b9cc 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -312,7 +312,7 @@ fn type_param_predicates( } } - Node::ForeignItem(item) => match item.node { + Node::ForeignItem(item) => match item.kind { ForeignItemKind::Fn(_, _, ref generics) => generics, _ => return result, }, @@ -415,7 +415,7 @@ fn convert_item(tcx: TyCtxt<'_>, item_id: hir::HirId) { tcx.generics_of(def_id); tcx.type_of(def_id); tcx.predicates_of(def_id); - if let hir::ForeignItemKind::Fn(..) = item.node { + if let hir::ForeignItemKind::Fn(..) = item.kind { tcx.fn_sig(def_id); } } @@ -872,7 +872,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option None, }, - Node::ForeignItem(item) => match item.node { + Node::ForeignItem(item) => match item.kind { hir::ForeignItemKind::Fn(ref fn_decl, _, ref generics) => { has_late_bound_regions(tcx, generics, fn_decl) } @@ -977,7 +977,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics { } } - Node::ForeignItem(item) => match item.node { + Node::ForeignItem(item) => match item.kind { ForeignItemKind::Static(..) => &no_generics, ForeignItemKind::Fn(_, _, ref generics) => generics, ForeignItemKind::Type => &no_generics, @@ -1331,7 +1331,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option match foreign_item.node { + Node::ForeignItem(foreign_item) => match foreign_item.kind { ForeignItemKind::Fn(..) => { let substs = InternalSubsts::identity_for_item(tcx, def_id); tcx.mk_fn_def(def_id, substs) @@ -1823,7 +1823,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> { }, ForeignItem(&hir::ForeignItem { - node: ForeignItemKind::Fn(ref fn_decl, _, _), + kind: ForeignItemKind::Fn(ref fn_decl, _, _), .. }) => { let abi = tcx.hir().get_foreign_abi(hir_id); @@ -2133,7 +2133,7 @@ fn explicit_predicates_of( } } - Node::ForeignItem(item) => match item.node { + Node::ForeignItem(item) => match item.kind { ForeignItemKind::Static(..) => NO_GENERICS, ForeignItemKind::Fn(_, _, ref generics) => generics, ForeignItemKind::Type => NO_GENERICS, @@ -2420,7 +2420,7 @@ fn static_mutability(tcx: TyCtxt<'_>, def_id: DefId) -> Option kind: hir::ItemKind::Static(_, mutbl, _), .. })) | Some(Node::ForeignItem( &hir::ForeignItem { - node: hir::ForeignItemKind::Static(_, mutbl), .. + kind: hir::ForeignItemKind::Static(_, mutbl), .. })) => Some(mutbl), Some(_) => None, _ => bug!("static_mutability applied to non-local def-id {:?}", def_id), diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 4dcb467e32b..4431abdaf50 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -94,7 +94,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for ConstraintContext<'a, 'tcx> { hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - if let hir::ForeignItemKind::Fn(..) = foreign_item.node { + if let hir::ForeignItemKind::Fn(..) = foreign_item.kind { self.visit_node_helper(foreign_item.hir_id); } } diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index b3c0bee50f3..745dbee5fd3 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -70,7 +70,7 @@ fn variances_of(tcx: TyCtxt<'_>, item_def_id: DefId) -> &[ty::Variance] { _ => unsupported() }, - Node::ForeignItem(item) => match item.node { + Node::ForeignItem(item) => match item.kind { hir::ForeignItemKind::Fn(..) => {} _ => unsupported() diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 0489cd90c83..863a0b267fd 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -157,7 +157,7 @@ impl<'a, 'tcx, 'v> ItemLikeVisitor<'v> for TermsContext<'a, 'tcx> { hir::ItemKind::ForeignMod(ref foreign_mod) => { for foreign_item in &foreign_mod.items { - if let hir::ForeignItemKind::Fn(..) = foreign_item.node { + if let hir::ForeignItemKind::Fn(..) = foreign_item.kind { self.add_inferreds_for_item(foreign_item.hir_id); } } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 8cf5fbe849f..b6a90e1fb98 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -561,7 +561,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { om.foreigns.push(ForeignItem { id: item.hir_id, name: renamed.unwrap_or(item.ident).name, - kind: &item.node, + kind: &item.kind, vis: &item.vis, attrs: &item.attrs, whence: item.span diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 15b30352e46..05ac90999af 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2421,7 +2421,7 @@ impl ItemKind { pub struct ForeignItem { pub ident: Ident, pub attrs: Vec, - pub node: ForeignItemKind, + pub kind: ForeignItemKind, pub id: NodeId, pub span: Span, pub vis: Visibility, diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index bc073a66795..aa813c03c36 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1378,7 +1378,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { .make_foreign_items(); } - if let ast::ForeignItemKind::Macro(mac) = foreign_item.node { + if let ast::ForeignItemKind::Macro(mac) = foreign_item.kind { self.check_attributes(&foreign_item.attrs); return self.collect_bang(mac, foreign_item.span, AstFragmentKind::ForeignItems) .make_foreign_items(); diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index a06de0f5517..8eecef1020d 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -65,7 +65,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment { AstFragmentKind::ForeignItems => AstFragment::ForeignItems(smallvec![ast::ForeignItem { id, span, ident, vis, attrs, - node: ast::ForeignItemKind::Macro(mac_placeholder()), + kind: ast::ForeignItemKind::Macro(mac_placeholder()), }]), AstFragmentKind::Pat => AstFragment::Pat(P(ast::Pat { id, span, kind: ast::PatKind::Mac(mac_placeholder()), @@ -275,7 +275,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { } fn flat_map_foreign_item(&mut self, item: ast::ForeignItem) -> SmallVec<[ast::ForeignItem; 1]> { - match item.node { + match item.kind { ast::ForeignItemKind::Macro(_) => self.remove(item.id).make_foreign_items(), _ => noop_flat_map_foreign_item(item, self), } diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 2ed4404fb3c..622b48ab928 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -408,7 +408,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } fn visit_foreign_item(&mut self, i: &'a ast::ForeignItem) { - match i.node { + match i.kind { ast::ForeignItemKind::Fn(..) | ast::ForeignItemKind::Static(..) => { let link_name = attr::first_attr_value_str_by_name(&i.attrs, sym::link_name); diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index c448aa980c6..ec4ab02444f 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -1035,10 +1035,10 @@ pub fn noop_flat_map_item(mut item: P, visitor: &mut T) pub fn noop_flat_map_foreign_item(mut item: ForeignItem, visitor: &mut T) -> SmallVec<[ForeignItem; 1]> { - let ForeignItem { ident, attrs, node, id, span, vis } = &mut item; + let ForeignItem { ident, attrs, kind, id, span, vis } = &mut item; visitor.visit_ident(ident); visit_attrs(attrs, visitor); - match node { + match kind { ForeignItemKind::Fn(fdec, generics) => { visitor.visit_fn_decl(fdec); visitor.visit_generics(generics); diff --git a/src/libsyntax/parse/parser/item.rs b/src/libsyntax/parse/parser/item.rs index 83721a2866a..370030d02c7 100644 --- a/src/libsyntax/parse/parser/item.rs +++ b/src/libsyntax/parse/parser/item.rs @@ -1383,7 +1383,7 @@ impl<'a> Parser<'a> { id: DUMMY_NODE_ID, attrs, vis: visibility, - node: ForeignItemKind::Macro(mac), + kind: ForeignItemKind::Macro(mac), } ) } @@ -1415,7 +1415,7 @@ impl<'a> Parser<'a> { Ok(ast::ForeignItem { ident, attrs, - node: ForeignItemKind::Fn(decl, generics), + kind: ForeignItemKind::Fn(decl, generics), id: DUMMY_NODE_ID, span: lo.to(hi), vis, @@ -1435,7 +1435,7 @@ impl<'a> Parser<'a> { Ok(ForeignItem { ident, attrs, - node: ForeignItemKind::Static(ty, mutbl), + kind: ForeignItemKind::Static(ty, mutbl), id: DUMMY_NODE_ID, span: lo.to(hi), vis, @@ -1453,7 +1453,7 @@ impl<'a> Parser<'a> { Ok(ast::ForeignItem { ident, attrs, - node: ForeignItemKind::Ty, + kind: ForeignItemKind::Ty, id: DUMMY_NODE_ID, span: lo.to(hi), vis diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 675490552e5..3cf5e4a248c 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1060,7 +1060,7 @@ impl<'a> State<'a> { self.hardbreak_if_not_bol(); self.maybe_print_comment(item.span.lo()); self.print_outer_attributes(&item.attrs); - match item.node { + match item.kind { ast::ForeignItemKind::Fn(ref decl, ref generics) => { self.head(""); self.print_fn(decl, ast::FnHeader::default(), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index ea6d27d4f29..a36783e2b64 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -486,7 +486,7 @@ pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, foreign_item: &'a visitor.visit_vis(&foreign_item.vis); visitor.visit_ident(foreign_item.ident); - match foreign_item.node { + match foreign_item.kind { ForeignItemKind::Fn(ref function_declaration, ref generics) => { walk_fn_decl(visitor, function_declaration); visitor.visit_generics(generics)