From c3d8791373005ef08c876aa649ede245efd2352d Mon Sep 17 00:00:00 2001 From: varkor Date: Thu, 26 Sep 2019 17:25:31 +0100 Subject: [PATCH] Rename `Ty.node` to `Ty.kind` --- src/librustc/hir/intravisit.rs | 2 +- src/librustc/hir/lowering.rs | 33 ++++++++++--------- src/librustc/hir/lowering/item.rs | 4 +-- src/librustc/hir/map/def_collector.rs | 2 +- src/librustc/hir/mod.rs | 4 +-- src/librustc/hir/print.rs | 4 +-- src/librustc/ich/impls_hir.rs | 4 +-- .../nice_region_error/find_anon_type.rs | 2 +- .../nice_region_error/named_anon_conflict.rs | 2 +- src/librustc/lint/internal.rs | 4 +-- src/librustc/middle/dead.rs | 2 +- src/librustc/middle/resolve_lifetime.rs | 22 ++++++------- src/librustc/traits/error_reporting.rs | 2 +- src/librustc_interface/util.rs | 2 +- src/librustc_lint/builtin.rs | 4 +-- src/librustc_metadata/encoder.rs | 2 +- .../borrow_check/conflict_errors.rs | 4 +-- .../borrow_check/mutability_errors.rs | 2 +- .../error_reporting/region_name.rs | 4 +-- src/librustc_passes/ast_validation.rs | 10 +++--- src/librustc_privacy/lib.rs | 6 ++-- src/librustc_resolve/build_reduced_graph.rs | 12 +++---- src/librustc_resolve/late.rs | 2 +- src/librustc_resolve/late/diagnostics.rs | 2 +- src/librustc_save_analysis/dump_visitor.rs | 4 +-- src/librustc_save_analysis/lib.rs | 4 +-- src/librustc_save_analysis/sig.rs | 2 +- src/librustc_typeck/astconv.rs | 8 ++--- src/librustc_typeck/check/compare_method.rs | 4 +-- src/librustc_typeck/check/demand.rs | 2 +- src/librustc_typeck/check/mod.rs | 8 ++--- src/librustc_typeck/collect.rs | 20 +++++------ src/librustdoc/clean/mod.rs | 4 +-- src/libsyntax/ast.rs | 16 ++++----- src/libsyntax/ext/base.rs | 2 +- src/libsyntax/ext/build.rs | 4 +-- src/libsyntax/ext/expand.rs | 4 +-- src/libsyntax/ext/placeholders.rs | 6 ++-- src/libsyntax/feature_gate/check.rs | 4 +-- src/libsyntax/mut_visit.rs | 4 +-- src/libsyntax/parse/diagnostics.rs | 10 +++--- src/libsyntax/parse/parser.rs | 2 +- src/libsyntax/parse/parser/expr.rs | 4 +-- src/libsyntax/parse/parser/item.rs | 6 ++-- src/libsyntax/parse/parser/ty.rs | 6 ++-- src/libsyntax/print/pprust.rs | 4 +-- src/libsyntax/visit.rs | 2 +- src/libsyntax_ext/concat_idents.rs | 2 +- src/libsyntax_ext/deriving/generic/mod.rs | 4 +-- src/libsyntax_ext/test.rs | 2 +- 50 files changed, 138 insertions(+), 137 deletions(-) diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 13e4ce4cbc2..b06cea5cd1a 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -594,7 +594,7 @@ pub fn walk_variant<'v, V: Visitor<'v>>(visitor: &mut V, pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { visitor.visit_id(typ.hir_id); - match typ.node { + match typ.kind { TyKind::Slice(ref ty) => { visitor.visit_ty(ty) } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index f2170714f1a..a62ef4e840c 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -346,7 +346,7 @@ struct ImplTraitTypeIdVisitor<'a> { ids: &'a mut SmallVec<[NodeId; 1]> } impl<'a, 'b> Visitor<'a> for ImplTraitTypeIdVisitor<'b> { fn visit_ty(&mut self, ty: &'a Ty) { - match ty.node { + match ty.kind { | TyKind::Typeof(_) | TyKind::BareFn(_) => return, @@ -497,7 +497,7 @@ impl<'a> LoweringContext<'a> { } fn visit_ty(&mut self, t: &'tcx Ty) { - match t.node { + match t.kind { // Mirrors the case in visit::walk_ty TyKind::BareFn(ref f) => { walk_list!( @@ -1104,7 +1104,7 @@ impl<'a> LoweringContext<'a> { let ty = this.lower_ty( &Ty { id: this.sess.next_node_id(), - node: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()), + kind: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()), span: constraint.span, }, itctx, @@ -1165,14 +1165,14 @@ impl<'a> LoweringContext<'a> { let id = self.lower_node_id(t.id); let qpath = self.lower_qpath(t.id, qself, path, param_mode, itctx); let ty = self.ty_path(id, t.span, qpath); - if let hir::TyKind::TraitObject(..) = ty.node { + if let hir::TyKind::TraitObject(..) = ty.kind { self.maybe_lint_bare_trait(t.span, t.id, qself.is_none() && path.is_global()); } ty } fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_>) -> hir::Ty { - let kind = match t.node { + let kind = match t.kind { TyKind::Infer => hir::TyKind::Infer, TyKind::Err => hir::TyKind::Err, TyKind::Slice(ref ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)), @@ -1345,7 +1345,7 @@ impl<'a> LoweringContext<'a> { }; hir::Ty { - node: kind, + kind, span: t.span, hir_id: self.lower_node_id(t.id), } @@ -1505,7 +1505,7 @@ impl<'a> LoweringContext<'a> { fn visit_ty(&mut self, t: &'v hir::Ty) { // Don't collect elided lifetimes used inside of `fn()` syntax. - if let hir::TyKind::BareFn(_) = t.node { + if let hir::TyKind::BareFn(_) = t.kind { let old_collect_elided_lifetimes = self.collect_elided_lifetimes; self.collect_elided_lifetimes = false; @@ -2026,7 +2026,7 @@ impl<'a> LoweringContext<'a> { .map(|ty| this.lower_ty_direct(ty, ImplTraitContext::disallowed())) .collect(); let mk_tup = |this: &mut Self, tys, span| { - hir::Ty { node: hir::TyKind::Tup(tys), hir_id: this.next_id(), span } + hir::Ty { kind: hir::TyKind::Tup(tys), hir_id: this.next_id(), span } }; ( hir::GenericArgs { @@ -2179,16 +2179,16 @@ impl<'a> LoweringContext<'a> { _ => false, }; - match arg.ty.node { + match arg.ty.kind { TyKind::ImplicitSelf if is_mutable_pat => hir::ImplicitSelfKind::Mut, TyKind::ImplicitSelf => hir::ImplicitSelfKind::Imm, // Given we are only considering `ImplicitSelf` types, we needn't consider // the case where we have a mutable pattern to a reference as that would // no longer be an `ImplicitSelf`. - TyKind::Rptr(_, ref mt) if mt.ty.node.is_implicit_self() && + TyKind::Rptr(_, ref mt) if mt.ty.kind.is_implicit_self() && mt.mutbl == ast::Mutability::Mutable => hir::ImplicitSelfKind::MutRef, - TyKind::Rptr(_, ref mt) if mt.ty.node.is_implicit_self() => + TyKind::Rptr(_, ref mt) if mt.ty.kind.is_implicit_self() => hir::ImplicitSelfKind::ImmRef, _ => hir::ImplicitSelfKind::None, } @@ -2403,7 +2403,7 @@ impl<'a> LoweringContext<'a> { let opaque_ty_ref = hir::TyKind::Def(hir::ItemId { id: opaque_ty_id }, generic_args.into()); hir::FunctionRetTy::Return(P(hir::Ty { - node: opaque_ty_ref, + kind: opaque_ty_ref, span, hir_id: self.next_id(), })) @@ -2424,7 +2424,7 @@ impl<'a> LoweringContext<'a> { FunctionRetTy::Default(ret_ty_span) => { P(hir::Ty { hir_id: self.next_id(), - node: hir::TyKind::Tup(hir_vec![]), + kind: hir::TyKind::Tup(hir_vec![]), span: *ret_ty_span, }) } @@ -3164,7 +3164,7 @@ impl<'a> LoweringContext<'a> { } fn ty_path(&mut self, mut hir_id: hir::HirId, span: Span, qpath: hir::QPath) -> hir::Ty { - let node = match qpath { + let kind = match qpath { hir::QPath::Resolved(None, path) => { // Turn trait object paths into `TyKind::TraitObject` instead. match path.res { @@ -3188,9 +3188,10 @@ impl<'a> LoweringContext<'a> { } _ => hir::TyKind::Path(qpath), }; + hir::Ty { hir_id, - node, + kind, span, } } @@ -3394,7 +3395,7 @@ pub fn is_range_literal(sess: &Session, expr: &hir::Expr) -> bool { // `..=` desugars into `::std::ops::RangeInclusive::new(...)`. ExprKind::Call(ref func, _) => { if let ExprKind::Path(QPath::TypeRelative(ref ty, ref segment)) = func.kind { - if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.node { + if let TyKind::Path(QPath::Resolved(None, ref path)) = ty.kind { let new_call = segment.ident.as_str() == "new"; return is_range_path(&path) && is_lit(sess, &expr.span) && new_call; } diff --git a/src/librustc/hir/lowering/item.rs b/src/librustc/hir/lowering/item.rs index c0540c8e94d..14311585652 100644 --- a/src/librustc/hir/lowering/item.rs +++ b/src/librustc/hir/lowering/item.rs @@ -789,7 +789,7 @@ impl LoweringContext<'_> { } fn lower_struct_field(&mut self, (index, f): (usize, &StructField)) -> hir::StructField { - let ty = if let TyKind::Path(ref qself, ref path) = f.ty.node { + let ty = if let TyKind::Path(ref qself, ref path) = f.ty.kind { let t = self.lower_path_ty( &f.ty, qself, @@ -1343,7 +1343,7 @@ impl LoweringContext<'_> { ); }; // Check if the where clause type is a plain type parameter. - match bound_pred.bounded_ty.node { + match bound_pred.bounded_ty.kind { TyKind::Path(None, ref path) if path.segments.len() == 1 && bound_pred.bound_generic_params.is_empty() => diff --git a/src/librustc/hir/map/def_collector.rs b/src/librustc/hir/map/def_collector.rs index 8237e4a58ab..0bfd8cbdfa2 100644 --- a/src/librustc/hir/map/def_collector.rs +++ b/src/librustc/hir/map/def_collector.rs @@ -292,7 +292,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> { } fn visit_ty(&mut self, ty: &'a Ty) { - match ty.node { + match ty.kind { TyKind::Mac(..) => return self.visit_macro_invoc(ty.id), TyKind::ImplTrait(node_id, _) => { self.create_def(node_id, DefPathData::ImplTrait, ty.span); diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 4bc34cae450..e2ea3d26558 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -479,7 +479,7 @@ impl GenericArgs { match arg { GenericArg::Lifetime(_) => {} GenericArg::Type(ref ty) => { - if let TyKind::Tup(ref tys) = ty.node { + if let TyKind::Tup(ref tys) = ty.kind { return tys; } break; @@ -1939,7 +1939,7 @@ impl TypeBinding { #[derive(RustcEncodable, RustcDecodable)] pub struct Ty { pub hir_id: HirId, - pub node: TyKind, + pub kind: TyKind, pub span: Span, } diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 6fbbbf7a1f2..7ca3482295c 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -286,7 +286,7 @@ impl<'a> State<'a> { pub fn print_type(&mut self, ty: &hir::Ty) { self.maybe_print_comment(ty.span.lo()); self.ibox(0); - match ty.node { + match ty.kind { hir::TyKind::Slice(ref ty) => { self.s.word("["); self.print_type(&ty); @@ -1880,7 +1880,7 @@ impl<'a> State<'a> { s.ann.nested(s, Nested::BodyParamPat(body_id, i)); i += 1; - if let hir::TyKind::Infer = ty.node { + if let hir::TyKind::Infer = ty.kind { // Print nothing. } else { s.s.word(":"); diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index f212b7318c3..01588657f33 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -144,11 +144,11 @@ impl<'a> HashStable> for hir::Ty { hcx.while_hashing_hir_bodies(true, |hcx| { let hir::Ty { hir_id: _, - ref node, + ref kind, ref span, } = *self; - node.hash_stable(hcx, hasher); + kind.hash_stable(hcx, hasher); span.hash_stable(hcx, hasher); }) } diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index 3878a98caa5..42017a23581 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -98,7 +98,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> { } fn visit_ty(&mut self, arg: &'tcx hir::Ty) { - match arg.node { + match arg.kind { hir::TyKind::BareFn(_) => { self.current_index.shift_in(1); intravisit::walk_ty(self, arg); diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs index 604115cfc37..a9a2c15d7d9 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs @@ -87,7 +87,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { return None; } if let FunctionRetTy::Return(ty) = &fndecl.output { - if let (TyKind::Def(_, _), ty::ReStatic) = (&ty.node, sub) { + if let (TyKind::Def(_, _), ty::ReStatic) = (&ty.kind, sub) { // This is an impl Trait return that evaluates de need of 'static. // We handle this case better in `static_impl_trait`. return None; diff --git a/src/librustc/lint/internal.rs b/src/librustc/lint/internal.rs index 13834eaf40f..f0271db54f6 100644 --- a/src/librustc/lint/internal.rs +++ b/src/librustc/lint/internal.rs @@ -94,7 +94,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TyTyKind { } fn check_ty(&mut self, cx: &LateContext<'_, '_>, ty: &'tcx Ty) { - match &ty.node { + match &ty.kind { TyKind::Path(qpath) => { if let QPath::Resolved(_, path) = qpath { if let Some(last) = path.segments.iter().last() { @@ -169,7 +169,7 @@ fn lint_ty_kind_usage(cx: &LateContext<'_, '_>, segment: &PathSegment) -> bool { } fn is_ty_or_ty_ctxt(cx: &LateContext<'_, '_>, ty: &Ty) -> Option { - match &ty.node { + match &ty.kind { TyKind::Path(qpath) => { if let QPath::Resolved(_, path) = qpath { let did = path.res.opt_def_id()?; diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 673cf6aba32..7d0b7e8e7e8 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -292,7 +292,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { } fn visit_ty(&mut self, ty: &'tcx hir::Ty) { - match ty.node { + match ty.kind { TyKind::Def(item_id, _) => { let item = self.tcx.hir().expect_item(item_id.id); intravisit::walk_item(self, item); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index cafc58024e2..875d0d7dd02 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -558,8 +558,8 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> { fn visit_ty(&mut self, ty: &'tcx hir::Ty) { debug!("visit_ty: id={:?} ty={:?}", ty.hir_id, ty); - debug!("visit_ty: ty.node={:?}", ty.node); - match ty.node { + debug!("visit_ty: ty.kind={:?}", ty.kind); + match ty.kind { hir::TyKind::BareFn(ref c) => { let next_early_index = self.next_early_index(); let was_in_fn_syntax = self.is_in_fn_syntax; @@ -1352,7 +1352,7 @@ fn object_lifetime_defaults_for_item( continue; } - let res = match data.bounded_ty.node { + let res = match data.bounded_ty.kind { hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => path.res, _ => continue, }; @@ -1487,7 +1487,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let mut elide_use = None; let mut find_arg_use_span = |inputs: &hir::HirVec| { for input in inputs { - match input.node { + match input.kind { hir::TyKind::Rptr(lt, _) => { if lt.name.ident() == name { // include the trailing whitespace between the lifetime and type names @@ -2270,8 +2270,8 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } fn visit_ty(&mut self, ty: &'a hir::Ty) { - if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.node { - if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.node + if let hir::TyKind::Rptr(lifetime_ref, ref mt) = ty.kind { + if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = mt.ty.kind { if self.is_self_ty(path.res) { if let Some(lifetime) = self.map.defs.get(&lifetime_ref.hir_id) { @@ -2286,7 +2286,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { let mut visitor = SelfVisitor { map: self.map, - impl_self: impl_self.map(|ty| &ty.node), + impl_self: impl_self.map(|ty| &ty.kind), lifetime: Set1::Empty, }; visitor.visit_ty(&inputs[0]); @@ -2364,10 +2364,10 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { } fn visit_ty(&mut self, ty: &hir::Ty) { - if let hir::TyKind::BareFn(_) = ty.node { + if let hir::TyKind::BareFn(_) = ty.kind { self.outer_index.shift_in(1); } - match ty.node { + match ty.kind { hir::TyKind::TraitObject(ref bounds, ref lifetime) => { for bound in bounds { self.visit_poly_trait_ref(bound, hir::TraitBoundModifier::None); @@ -2384,7 +2384,7 @@ impl<'a, 'tcx> LifetimeContext<'a, 'tcx> { intravisit::walk_ty(self, ty); } } - if let hir::TyKind::BareFn(_) = ty.node { + if let hir::TyKind::BareFn(_) = ty.kind { self.outer_index.shift_out(1); } } @@ -2991,7 +2991,7 @@ fn insert_late_bound_lifetimes( } fn visit_ty(&mut self, ty: &'v hir::Ty) { - match ty.node { + match ty.kind { hir::TyKind::Path(hir::QPath::Resolved(Some(_), _)) | hir::TyKind::Path(hir::QPath::TypeRelative(..)) => { // ignore lifetimes appearing in associated type diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index d2b34ed37cd..13601c6fe16 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1177,7 +1177,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .. }) => { (self.tcx.sess.source_map().def_span(span), decl.inputs.iter() - .map(|arg| match arg.clone().node { + .map(|arg| match arg.clone().kind { hir::TyKind::Tup(ref tys) => ArgKind::Tuple( Some(arg.span), vec![("_".to_owned(), "_".to_owned()); tys.len()] diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs index 7b6c5f5e638..44899721b1f 100644 --- a/src/librustc_interface/util.rs +++ b/src/librustc_interface/util.rs @@ -738,7 +738,7 @@ impl<'a> ReplaceBodyWithLoop<'a> { fn should_ignore_fn(ret_ty: &ast::FnDecl) -> bool { if let ast::FunctionRetTy::Ty(ref ty) = ret_ty.output { fn involves_impl_trait(ty: &ast::Ty) -> bool { - match ty.node { + match ty.kind { ast::TyKind::ImplTrait(..) => true, ast::TyKind::Slice(ref subty) | ast::TyKind::Array(ref subty, _) | diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index dd5e68995cc..f7695b18c5f 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1090,7 +1090,7 @@ impl TypeAliasBounds { match *qpath { hir::QPath::TypeRelative(ref ty, _) => { // If this is a type variable, we found a `T::Assoc`. - match ty.node { + match ty.kind { hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) => { match path.res { Res::Def(DefKind::TyParam, _) => true, @@ -1750,7 +1750,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExplicitOutlivesRequirements { hir::WherePredicate::BoundPredicate(predicate) => { // FIXME we can also infer bounds on associated types, // and should check for them here. - match predicate.bounded_ty.node { + match predicate.bounded_ty.kind { hir::TyKind::Path(hir::QPath::Resolved( None, ref path, diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 060672221dd..1c72a8c6ddb 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -1799,7 +1799,7 @@ impl EncodeContext<'tcx> { } fn encode_info_for_ty(&mut self, ty: &hir::Ty) { - match ty.node { + match ty.kind { hir::TyKind::Array(_, ref length) => { let def_id = self.tcx.hir().local_def_id(length.hir_id); self.record(def_id, EncodeContext::encode_info_for_anon_const, def_id); diff --git a/src/librustc_mir/borrow_check/conflict_errors.rs b/src/librustc_mir/borrow_check/conflict_errors.rs index 5fb41dc20c7..9788631fc95 100644 --- a/src/librustc_mir/borrow_check/conflict_errors.rs +++ b/src/librustc_mir/borrow_check/conflict_errors.rs @@ -1845,7 +1845,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // Need to use the `rustc::ty` types to compare against the // `return_region`. Then use the `rustc::hir` type to get only // the lifetime span. - if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].node { + if let hir::TyKind::Rptr(lifetime, _) = &fn_decl.inputs[index].kind { // With access to the lifetime, we can get // the span of it. arguments.push((*argument, lifetime.span)); @@ -1866,7 +1866,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { let return_ty = *sig.output().skip_binder(); let mut return_span = fn_decl.output.span(); if let hir::FunctionRetTy::Return(ty) = &fn_decl.output { - if let hir::TyKind::Rptr(lifetime, _) = ty.node { + if let hir::TyKind::Rptr(lifetime, _) = ty.kind { return_span = lifetime.span; } } diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index d0dd06f64d1..33520b6755c 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -642,7 +642,7 @@ fn annotate_struct_field( if let hir::TyKind::Rptr(lifetime, hir::MutTy { mutbl: hir::Mutability::MutImmutable, ref ty - }) = field.ty.node { + }) = field.ty.kind { // Get the snippets in two parts - the named lifetime (if there is one) and // type being referenced, that way we can reconstruct the snippet without loss // of detail. diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 7c65b4f00bf..c4b508e030f 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -425,7 +425,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let mir_hir_id = infcx.tcx.hir().as_local_hir_id(mir_def_id)?; let fn_decl = infcx.tcx.hir().fn_decl_by_hir_id(mir_hir_id)?; let argument_hir_ty: &hir::Ty = &fn_decl.inputs[argument_index]; - match argument_hir_ty.node { + match argument_hir_ty.kind { // This indicates a variable with no type annotation, like // `|x|`... in that case, we can't highlight the type but // must highlight the variable. @@ -527,7 +527,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { &mut vec![(argument_ty, argument_hir_ty)]; while let Some((ty, hir_ty)) = search_stack.pop() { - match (&ty.kind, &hir_ty.node) { + match (&ty.kind, &hir_ty.kind) { // Check if the `argument_ty` is `&'X ..` where `'X` // is the region we are looking for -- if so, and we have a `&T` // on the RHS, then we want to highlight the `&` like so: diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs index 6e640b93d7d..5ccf73290a6 100644 --- a/src/librustc_passes/ast_validation.rs +++ b/src/librustc_passes/ast_validation.rs @@ -107,7 +107,7 @@ impl<'a> AstValidator<'a> { // rust-lang/rust#57979: bug in old `visit_generic_args` called // `walk_ty` rather than `visit_ty`, skipping outer `impl Trait` // if it happened to occur at `ty`. - if let TyKind::ImplTrait(..) = ty.node { + if let TyKind::ImplTrait(..) = ty.kind { self.warning_period_57979_didnt_record_next_impl_trait = true; } } @@ -126,7 +126,7 @@ impl<'a> AstValidator<'a> { // rust-lang/rust#57979: bug in old `visit_generic_args` called // `walk_ty` rather than `visit_ty`, skippping outer `impl Trait` // if it happened to occur at `ty`. - if let TyKind::ImplTrait(..) = ty.node { + if let TyKind::ImplTrait(..) = ty.kind { self.warning_period_57979_didnt_record_next_impl_trait = true; } self.visit_ty(ty); @@ -149,7 +149,7 @@ impl<'a> AstValidator<'a> { // Mirrors `visit::walk_ty`, but tracks relevant state. fn walk_ty(&mut self, t: &'a Ty) { - match t.node { + match t.kind { TyKind::ImplTrait(..) => { let outer_impl_trait = self.outer_impl_trait(t.span); self.with_impl_trait(Some(outer_impl_trait), |this| visit::walk_ty(this, t)) @@ -456,7 +456,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { } fn visit_ty(&mut self, ty: &'a Ty) { - match ty.node { + match ty.kind { TyKind::BareFn(ref bfty) => { self.check_fn_decl(&bfty.decl); self.check_decl_no_pat(&bfty.decl, |span, _| { @@ -541,7 +541,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { match item.node { ItemKind::Impl(unsafety, polarity, _, _, Some(..), ref ty, ref impl_items) => { self.invalid_visibility(&item.vis, None); - if let TyKind::Err = ty.node { + if let TyKind::Err = ty.kind { self.err_handler() .struct_span_err(item.span, "`impl Trait for .. {}` is an obsolete syntax") .help("use `auto trait Trait {}` instead").emit(); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index a4b2b31374b..a72c9e574d0 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1389,14 +1389,14 @@ impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a } fn visit_ty(&mut self, ty: &hir::Ty) { - if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.node { + if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = ty.kind { if self.inner.path_is_private_type(path) { self.contains_private = true; // Found what we're looking for, so let's stop working. return } } - if let hir::TyKind::Path(_) = ty.node { + if let hir::TyKind::Path(_) = ty.kind { if self.at_outer_type { self.outer_type_is_public_path = true; } @@ -1628,7 +1628,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { } fn visit_ty(&mut self, t: &'tcx hir::Ty) { - if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.node { + if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = t.kind { if self.path_is_private_type(path) { self.old_error_set.insert(t.hir_id); } diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index c12a4c6c06b..ba612bb04ac 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -1120,9 +1120,9 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> { } macro_rules! method { - ($visit:ident: $ty:ty, $invoc:path, $walk:ident, $kind:ident) => { + ($visit:ident: $ty:ty, $invoc:path, $walk:ident) => { fn $visit(&mut self, node: &'b $ty) { - if let $invoc(..) = node.$kind { + if let $invoc(..) = node.kind { self.visit_invoc(node.id); } else { visit::$walk(self, node); @@ -1132,10 +1132,10 @@ macro_rules! method { } impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> { - method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item, kind); - method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr, kind); - method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat, kind); - method!(visit_ty: ast::Ty, ast::TyKind::Mac, walk_ty, node); + method!(visit_impl_item: ast::ImplItem, ast::ImplItemKind::Macro, walk_impl_item); + method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr); + method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat); + method!(visit_ty: ast::Ty, ast::TyKind::Mac, walk_ty); fn visit_item(&mut self, item: &'b Item) { let macro_use = match item.node { diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs index f1de620d056..9ae1699fb05 100644 --- a/src/librustc_resolve/late.rs +++ b/src/librustc_resolve/late.rs @@ -384,7 +384,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LateResolutionVisitor<'a, '_> { self.resolve_local(local); } fn visit_ty(&mut self, ty: &'tcx Ty) { - match ty.node { + match ty.kind { TyKind::Path(ref qself, ref path) => { self.smart_resolve_path(ty.id, qself.as_ref(), path, PathSource::Type); } diff --git a/src/librustc_resolve/late/diagnostics.rs b/src/librustc_resolve/late/diagnostics.rs index e04e56cb945..0d35cc53ac6 100644 --- a/src/librustc_resolve/late/diagnostics.rs +++ b/src/librustc_resolve/late/diagnostics.rs @@ -472,7 +472,7 @@ impl<'a> LateResolutionVisitor<'a, '_> { where FilterFn: Fn(Res) -> bool { fn extract_node_id(t: &Ty) -> Option { - match t.node { + match t.kind { TyKind::Path(None, _) => Some(t.id), TyKind::Rptr(_, ref mut_ty) => extract_node_id(&mut_ty.ty), // This doesn't handle the remaining `Ty` variants as they are not diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 8ea770696f9..c24552678eb 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -385,7 +385,7 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> { } if let ast::FunctionRetTy::Ty(ref ret_ty) = decl.output { - if let ast::TyKind::ImplTrait(..) = ret_ty.node { + if let ast::TyKind::ImplTrait(..) = ret_ty.kind { // FIXME: Opaque type desugaring prevents us from easily // processing trait bounds. See `visit_ty` for more details. } else { @@ -1421,7 +1421,7 @@ impl<'l, 'tcx> Visitor<'l> for DumpVisitor<'l, 'tcx> { fn visit_ty(&mut self, t: &'l ast::Ty) { self.process_macro_use(t.span); - match t.node { + match t.kind { ast::TyKind::Path(_, ref path) => { if generated_code(t.span) { return; diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 8ce85e01da1..bc067ab6ba5 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -301,7 +301,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { })) } ast::ItemKind::Impl(.., ref trait_ref, ref typ, ref impls) => { - if let ast::TyKind::Path(None, ref path) = typ.node { + if let ast::TyKind::Path(None, ref path) = typ.kind { // Common case impl for a struct or something basic. if generated_code(path.span) { return None; @@ -652,7 +652,7 @@ impl<'l, 'tcx> SaveContext<'l, 'tcx> { .. }) | Node::Ty(&hir::Ty { - node: hir::TyKind::Path(ref qpath), + kind: hir::TyKind::Path(ref qpath), .. }) => { self.tables.qpath_res(qpath, hir_id) diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs index b34506a4f1d..87417f577a1 100644 --- a/src/librustc_save_analysis/sig.rs +++ b/src/librustc_save_analysis/sig.rs @@ -160,7 +160,7 @@ fn text_sig(text: String) -> Signature { impl Sig for ast::Ty { fn make(&self, offset: usize, _parent_id: Option, scx: &SaveContext<'_, '_>) -> Result { let id = Some(self.id); - match self.node { + match self.kind { ast::TyKind::Slice(ref ty) => { let nested = ty.make(offset + 1, id, scx)?; let text = format!("[{}]", nested.text); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index ae9c021d242..6f1d854481a 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2075,11 +2075,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { /// internal notion of a type. pub fn ast_ty_to_ty(&self, ast_ty: &hir::Ty) -> Ty<'tcx> { debug!("ast_ty_to_ty(id={:?}, ast_ty={:?} ty_ty={:?})", - ast_ty.hir_id, ast_ty, ast_ty.node); + ast_ty.hir_id, ast_ty, ast_ty.kind); let tcx = self.tcx(); - let result_ty = match ast_ty.node { + let result_ty = match ast_ty.kind { hir::TyKind::Slice(ref ty) => { tcx.mk_slice(self.ast_ty_to_ty(&ty)) } @@ -2123,7 +2123,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { debug!("ast_ty_to_ty: qself={:?} segment={:?}", qself, segment); let ty = self.ast_ty_to_ty(qself); - let res = if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = qself.node { + let res = if let hir::TyKind::Path(hir::QPath::Resolved(_, ref path)) = qself.kind { path.res } else { Res::Err @@ -2270,7 +2270,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { expected_ty: Option>) -> Ty<'tcx> { - match ty.node { + match ty.kind { hir::TyKind::Infer if expected_ty.is_some() => { self.record_ty(ty.hir_id, expected_ty.unwrap(), ty.span); expected_ty.unwrap() diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index c69c94d6c84..6818d5f521d 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -445,7 +445,7 @@ fn extract_spans_for_error_reporting<'a, 'tcx>( }; impl_m_iter.zip(trait_m_iter).find(|&(ref impl_arg, ref trait_arg)| { - match (&impl_arg.node, &trait_arg.node) { + match (&impl_arg.kind, &trait_arg.kind) { (&hir::TyKind::Rptr(_, ref impl_mt), &hir::TyKind::Rptr(_, ref trait_mt)) | (&hir::TyKind::Ptr(ref impl_mt), &hir::TyKind::Ptr(ref trait_mt)) => { impl_mt.mutbl != trait_mt.mutbl @@ -892,7 +892,7 @@ fn compare_synthetic_generics<'tcx>( fn visit_ty(&mut self, ty: &'v hir::Ty) { hir::intravisit::walk_ty(self, ty); if let hir::TyKind::Path( - hir::QPath::Resolved(None, ref path)) = ty.node + hir::QPath::Resolved(None, ref path)) = ty.kind { if let Res::Def(DefKind::TyParam, def_id) = path.res { if def_id == self.1 { diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 0878e72932a..2ea0afb1793 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -596,7 +596,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let ( hir::TyKind::Path(hir::QPath::Resolved(None, base_ty_path)), sym::from, - ) = (&base_ty.node, path_segment.ident.name) { + ) = (&base_ty.kind, path_segment.ident.name) { if let Some(ident) = &base_ty_path.segments.iter().map(|s| s.ident).next() { match ident.name { sym::i128 | sym::i64 | sym::i32 | sym::i16 | sym::i8 | diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 850eed12f84..c076a41f775 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -886,7 +886,7 @@ fn typeck_tables_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::TypeckTables<'_> { fcx } else { let fcx = FnCtxt::new(&inh, param_env, body.value.hir_id); - let expected_type = body_ty.and_then(|ty| match ty.node { + let expected_type = body_ty.and_then(|ty| match ty.kind { hir::TyKind::Infer => Some(AstConv::ast_ty_to_ty(&fcx, ty)), _ => None }).unwrap_or_else(|| tcx.type_of(def_id)); @@ -3509,7 +3509,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let hir::GenericArg::Type(hir_ty) = &arg { if let hir::TyKind::Path( hir::QPath::TypeRelative(..), - ) = &hir_ty.node { + ) = &hir_ty.kind { // Avoid ICE with associated types. As this is best // effort only, it's ok to ignore the case. It // would trigger in `is_send::();` @@ -3722,7 +3722,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { QPath::TypeRelative(ref qself, ref segment) => { let ty = self.to_ty(qself); - let res = if let hir::TyKind::Path(QPath::Resolved(_, ref path)) = qself.node { + let res = if let hir::TyKind::Path(QPath::Resolved(_, ref path)) = qself.kind { path.res } else { Res::Err @@ -4450,7 +4450,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (&hir::FunctionRetTy::Return(ref ty), _, _, _) => { // Only point to return type if the expected type is the return type, as if they // are not, the expectation must have been caused by something else. - debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.node); + debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.kind); let sp = ty.span; let ty = AstConv::ast_ty_to_ty(self, ty); debug!("suggest_missing_return_type: return type {:?}", ty); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index caddba9f5a8..019f39ed6e1 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -387,7 +387,7 @@ impl ItemCtxt<'tcx> { /// `ast_ty_to_ty`, because we want to avoid triggering an all-out /// conversion of the type to avoid inducing unnecessary cycles. fn is_param(tcx: TyCtxt<'_>, ast_ty: &hir::Ty, param_id: hir::HirId) -> bool { - if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.node { + if let hir::TyKind::Path(hir::QPath::Resolved(None, ref path)) = ast_ty.kind { match path.res { Res::SelfTy(Some(def_id), None) | Res::Def(DefKind::TyParam, def_id) => { def_id == tcx.hir().local_def_id(param_id) @@ -796,7 +796,7 @@ fn has_late_bound_regions<'tcx>(tcx: TyCtxt<'tcx>, node: Node<'tcx>) -> Option { self.outer_index.shift_in(1); intravisit::walk_ty(self, ty); @@ -1214,7 +1214,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option { body_id.and_then(|body_id| { - if let hir::TyKind::Infer = ty.node { + if let hir::TyKind::Infer = ty.kind { Some(infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident)) } else { None @@ -1236,7 +1236,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option { - if let hir::TyKind::Infer = ty.node { + if let hir::TyKind::Infer = ty.kind { infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident) } else { icx.to_ty(ty) @@ -1268,7 +1268,7 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option { - if let hir::TyKind::Infer = ty.node { + if let hir::TyKind::Infer = ty.kind { infer_placeholder_type(tcx, def_id, body_id, ty.span, item.ident) } else { icx.to_ty(ty) @@ -1373,11 +1373,11 @@ pub fn checked_type_of(tcx: TyCtxt<'_>, def_id: DefId, fail: bool) -> Option, def_id: DefId, fail: bool) -> Option { let path = match parent_node { Node::Ty(&hir::Ty { - node: hir::TyKind::Path(QPath::Resolved(_, ref path)), + kind: hir::TyKind::Path(QPath::Resolved(_, ref path)), .. }) | Node::Expr(&hir::Expr { @@ -1769,7 +1769,7 @@ fn find_opaque_ty_constraints(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { pub fn get_infer_ret_ty(output: &'_ hir::FunctionRetTy) -> Option<&hir::Ty> { if let hir::FunctionRetTy::Return(ref ty) = output { - if let hir::TyKind::Infer = ty.node { + if let hir::TyKind::Infer = ty.kind { return Some(&**ty) } } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 8479502722f..161b1a996a9 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2835,7 +2835,7 @@ impl Clean for hir::Ty { fn clean(&self, cx: &DocContext<'_>) -> Type { use rustc::hir::*; - match self.node { + match self.kind { TyKind::Never => Never, TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)), TyKind::Rptr(ref l, ref m) => { @@ -3031,7 +3031,7 @@ impl Clean for hir::Ty { } TyKind::BareFn(ref barefn) => BareFunction(box barefn.clean(cx)), TyKind::Infer | TyKind::Err => Infer, - TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.node), + TyKind::Typeof(..) => panic!("unimplemented type {:?}", self.kind), TyKind::CVarArgs(_) => CVarArgs, } } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index f5a9c18dba1..73751c422f6 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -525,7 +525,7 @@ impl Pat { /// Attempt reparsing the pattern as a type. /// This is intended for use by diagnostics. pub(super) fn to_ty(&self) -> Option> { - let node = match &self.kind { + let kind = match &self.kind { // In a type expression `_` is an inference variable. PatKind::Wild => TyKind::Infer, // An IDENT pattern with no binding mode would be valid as path to a type. E.g. `u32`. @@ -555,7 +555,7 @@ impl Pat { }; Some(P(Ty { - node, + kind, id: self.id, span: self.span, })) @@ -1051,7 +1051,7 @@ impl Expr { }; Some(P(Ty { - node: kind, + kind, id: self.id, span: self.span, })) @@ -1664,7 +1664,7 @@ pub enum AssocTyConstraintKind { #[derive(Clone, RustcEncodable, RustcDecodable)] pub struct Ty { pub id: NodeId, - pub node: TyKind, + pub kind: TyKind, pub span: Span, } @@ -1823,9 +1823,9 @@ impl Param { pub fn to_self(&self) -> Option { if let PatKind::Ident(BindingMode::ByValue(mutbl), ident, _) = self.pat.kind { if ident.name == kw::SelfLower { - return match self.ty.node { + return match self.ty.kind { TyKind::ImplicitSelf => Some(respan(self.pat.span, SelfKind::Value(mutbl))), - TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.node.is_implicit_self() => { + TyKind::Rptr(lt, MutTy { ref ty, mutbl }) if ty.kind.is_implicit_self() => { Some(respan(self.pat.span, SelfKind::Region(lt, mutbl))) } _ => Some(respan( @@ -1850,7 +1850,7 @@ impl Param { let span = eself.span.to(eself_ident.span); let infer_ty = P(Ty { id: DUMMY_NODE_ID, - node: TyKind::ImplicitSelf, + kind: TyKind::ImplicitSelf, span, }); let param = |mutbl, ty| Param { @@ -1872,7 +1872,7 @@ impl Param { Mutability::Immutable, P(Ty { id: DUMMY_NODE_ID, - node: TyKind::Rptr( + kind: TyKind::Rptr( lt, MutTy { ty: infer_ty, diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 22c07b2cf9c..a0093808412 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -568,7 +568,7 @@ impl DummyResult { pub fn raw_ty(sp: Span, is_error: bool) -> P { P(ast::Ty { id: ast::DUMMY_NODE_ID, - node: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) }, + kind: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) }, span: sp }) } diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index ff52bd1e971..98b434abea4 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -54,11 +54,11 @@ impl<'a> ExtCtxt<'a> { } } - pub fn ty(&self, span: Span, ty: ast::TyKind) -> P { + pub fn ty(&self, span: Span, kind: ast::TyKind) -> P { P(ast::Ty { id: ast::DUMMY_NODE_ID, span, - node: ty + kind, }) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 13ac6266fb6..98a4de4cfe9 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -1348,13 +1348,13 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { } fn visit_ty(&mut self, ty: &mut P) { - match ty.node { + match ty.kind { ast::TyKind::Mac(_) => {} _ => return noop_visit_ty(ty, self), }; visit_clobber(ty, |mut ty| { - match mem::replace(&mut ty.node, ast::TyKind::Err) { + match mem::replace(&mut ty.kind, ast::TyKind::Err) { ast::TyKind::Mac(mac) => self.collect_bang(mac, ty.span, AstFragmentKind::Ty).make_ty(), _ => unreachable!(), diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index a1278c9c7a8..05b4985bb73 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -34,7 +34,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment { }); let ty = P(ast::Ty { id, - node: ast::TyKind::Mac(mac_placeholder()), + kind: ast::TyKind::Mac(mac_placeholder()), span, }); let pat = P(ast::Pat { @@ -71,7 +71,7 @@ pub fn placeholder(kind: AstFragmentKind, id: ast::NodeId) -> AstFragment { id, span, kind: ast::PatKind::Mac(mac_placeholder()), })), AstFragmentKind::Ty => AstFragment::Ty(P(ast::Ty { - id, span, node: ast::TyKind::Mac(mac_placeholder()), + id, span, kind: ast::TyKind::Mac(mac_placeholder()), })), AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{ let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new())); @@ -318,7 +318,7 @@ impl<'a, 'b> MutVisitor for PlaceholderExpander<'a, 'b> { } fn visit_ty(&mut self, ty: &mut P) { - match ty.node { + match ty.kind { ast::TyKind::Mac(_) => *ty = self.remove(ty.id).make_ty(), _ => noop_visit_ty(ty, self), } diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index b041c2d46a1..1729ae7eae8 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -432,7 +432,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } fn visit_ty(&mut self, ty: &'a ast::Ty) { - match ty.node { + match ty.kind { ast::TyKind::BareFn(ref bare_fn_ty) => { self.check_abi(bare_fn_ty.abi, ty.span); } @@ -447,7 +447,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) { if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty { - if let ast::TyKind::Never = output_ty.node { + if let ast::TyKind::Never = output_ty.kind { // Do nothing. } else { self.visit_ty(output_ty) diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 3e2a1fa6a80..c08e154e045 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -432,9 +432,9 @@ pub fn noop_visit_ty_constraint( } pub fn noop_visit_ty(ty: &mut P, vis: &mut T) { - let Ty { id, node, span } = ty.deref_mut(); + let Ty { id, kind, span } = ty.deref_mut(); vis.visit_id(id); - match node { + match kind { TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never | TyKind::CVarArgs => {} TyKind::Slice(ty) => vis.visit_ty(ty), diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index ecc1cdd8bca..62cb836e31e 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -25,7 +25,7 @@ crate fn dummy_arg(ident: Ident) -> Param { span: ident.span, }); let ty = Ty { - node: TyKind::Err, + kind: TyKind::Err, span: ident.span, id: ast::DUMMY_NODE_ID }; @@ -135,7 +135,7 @@ impl RecoverQPath for Ty { fn recovered(qself: Option, path: ast::Path) -> Self { Self { span: path.span, - node: TyKind::Path(qself, path), + kind: TyKind::Path(qself, path), id: ast::DUMMY_NODE_ID, } } @@ -663,7 +663,7 @@ impl<'a> Parser<'a> { pprust::ty_to_string(ty) ); - match ty.node { + match ty.kind { TyKind::Rptr(ref lifetime, ref mut_ty) => { let sum_with_parens = pprust::to_string(|s| { s.s.word("&"); @@ -1296,7 +1296,7 @@ impl<'a> Parser<'a> { is_trait_item: bool, ) -> PResult<'a, ast::Param> { let sp = param.pat.span; - param.ty.node = TyKind::Err; + param.ty.kind = TyKind::Err; let mut err = self.struct_span_err(sp, "unexpected `self` parameter in function"); if is_trait_item { err.span_label(sp, "must be the first associated function parameter"); @@ -1360,7 +1360,7 @@ impl<'a> Parser<'a> { let mut seen_inputs = FxHashSet::default(); for input in fn_inputs.iter_mut() { let opt_ident = if let (PatKind::Ident(_, ident, _), TyKind::Err) = ( - &input.pat.kind, &input.ty.node, + &input.pat.kind, &input.ty.kind, ) { Some(*ident) } else { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b2b6504919e..cc582819b6b 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1212,7 +1212,7 @@ impl<'a> Parser<'a> { do_not_enforce_named_arguments_for_c_variadic ) { Ok(param) => { - if let TyKind::CVarArgs = param.ty.node { + if let TyKind::CVarArgs = param.ty.kind { c_variadic = true; if p.token != token::CloseDelim(token::Paren) { let span = p.token.span; diff --git a/src/libsyntax/parse/parser/expr.rs b/src/libsyntax/parse/parser/expr.rs index deb2140f797..c776704b285 100644 --- a/src/libsyntax/parse/parser/expr.rs +++ b/src/libsyntax/parse/parser/expr.rs @@ -555,7 +555,7 @@ impl<'a> Parser<'a> { let span_after_type = parser_snapshot_after_type.token.span; let expr = mk_expr(self, P(Ty { span: path.span, - node: TyKind::Path(None, path), + kind: TyKind::Path(None, path), id: DUMMY_NODE_ID, })); @@ -1190,7 +1190,7 @@ impl<'a> Parser<'a> { } else { P(Ty { id: DUMMY_NODE_ID, - node: TyKind::Infer, + kind: TyKind::Infer, span: self.prev_span, }) }; diff --git a/src/libsyntax/parse/parser/item.rs b/src/libsyntax/parse/parser/item.rs index e96d35e1999..27b0325db12 100644 --- a/src/libsyntax/parse/parser/item.rs +++ b/src/libsyntax/parse/parser/item.rs @@ -678,7 +678,7 @@ impl<'a> Parser<'a> { self.look_ahead(1, |t| t != &token::Lt) { let span = self.prev_span.between(self.token.span); self.struct_span_err(span, "missing trait in a trait impl").emit(); - P(Ty { node: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID }) + P(Ty { kind: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID }) } else { self.parse_ty()? }; @@ -715,7 +715,7 @@ impl<'a> Parser<'a> { } let ty_first = ty_first.into_inner(); - let path = match ty_first.node { + let path = match ty_first.kind { // This notably includes paths passed through `ty` macro fragments (#46438). TyKind::Path(None, path) => path, _ => { @@ -1526,7 +1526,7 @@ impl<'a> Parser<'a> { // The user intended that the type be inferred, // so treat this as if the user wrote e.g. `const A: _ = expr;`. P(Ty { - node: TyKind::Infer, + kind: TyKind::Infer, span: id.span, id: ast::DUMMY_NODE_ID, }) diff --git a/src/libsyntax/parse/parser/ty.rs b/src/libsyntax/parse/parser/ty.rs index 5697edd8e48..b4c006ca2b1 100644 --- a/src/libsyntax/parse/parser/ty.rs +++ b/src/libsyntax/parse/parser/ty.rs @@ -55,7 +55,7 @@ impl<'a> Parser<'a> { let lo = self.token.span; let mut impl_dyn_multi = false; - let node = if self.eat(&token::OpenDelim(token::Paren)) { + let kind = if self.eat(&token::OpenDelim(token::Paren)) { // `(TYPE)` is a parenthesized type. // `(TYPE,)` is a tuple with a single field of type TYPE. let mut ts = vec![]; @@ -75,7 +75,7 @@ impl<'a> Parser<'a> { if ts.len() == 1 && !last_comma { let ty = ts.into_iter().nth(0).unwrap().into_inner(); let maybe_bounds = allow_plus && self.token.is_like_plus(); - match ty.node { + match ty.kind { // `(TY_BOUND_NOPAREN) + BOUND + ...`. TyKind::Path(None, ref path) if maybe_bounds => { self.parse_remaining_bounds(Vec::new(), path.clone(), lo, true)? @@ -211,7 +211,7 @@ impl<'a> Parser<'a> { }; let span = lo.to(self.prev_span); - let ty = P(Ty { node, span, id: ast::DUMMY_NODE_ID }); + let ty = P(Ty { kind, span, id: ast::DUMMY_NODE_ID }); // Try to recover from use of `+` with incorrect priority. self.maybe_report_ambiguous_plus(allow_plus, impl_dyn_multi, &ty); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 50e45184427..7eaaab9e70d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -966,7 +966,7 @@ impl<'a> State<'a> { crate fn print_type(&mut self, ty: &ast::Ty) { self.maybe_print_comment(ty.span.lo()); self.ibox(0); - match ty.node { + match ty.kind { ast::TyKind::Slice(ref ty) => { self.s.word("["); self.print_type(ty); @@ -2760,7 +2760,7 @@ impl<'a> State<'a> { self.print_outer_attributes_inline(&input.attrs); - match input.ty.node { + match input.ty.kind { ast::TyKind::Infer if is_closure => self.print_pat(&input.pat), _ => { if let Some(eself) = input.to_self() { diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 54566b3e038..16616cf3185 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -333,7 +333,7 @@ pub fn walk_field_pattern<'a, V: Visitor<'a>>(visitor: &mut V, fp: &'a FieldPat) } pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) { - match typ.node { + match typ.kind { TyKind::Slice(ref ty) | TyKind::Paren(ref ty) => { visitor.visit_ty(ty) } diff --git a/src/libsyntax_ext/concat_idents.rs b/src/libsyntax_ext/concat_idents.rs index 912eba94b1f..f6747658c07 100644 --- a/src/libsyntax_ext/concat_idents.rs +++ b/src/libsyntax_ext/concat_idents.rs @@ -56,7 +56,7 @@ pub fn expand_concat_idents<'cx>(cx: &'cx mut ExtCtxt<'_>, fn make_ty(self: Box) -> Option> { Some(P(ast::Ty { id: ast::DUMMY_NODE_ID, - node: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)), + kind: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)), span: self.ident.span, })) } diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index a1986d380f7..b4306a1fd16 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -355,7 +355,7 @@ fn find_type_parameters( impl<'a, 'b> visit::Visitor<'a> for Visitor<'a, 'b> { fn visit_ty(&mut self, ty: &'a ast::Ty) { - if let ast::TyKind::Path(_, ref path) = ty.node { + if let ast::TyKind::Path(_, ref path) = ty.kind { if let Some(segment) = path.segments.first() { if self.ty_param_names.contains(&segment.ident.name) { self.types.push(P(ty.clone())); @@ -612,7 +612,7 @@ impl<'a> TraitDef<'a> { for ty in tys { // if we have already handled this type, skip it - if let ast::TyKind::Path(_, ref p) = ty.node { + if let ast::TyKind::Path(_, ref p) = ty.kind { if p.segments.len() == 1 && ty_param_names.contains(&p.segments[0].ident.name) { continue; diff --git a/src/libsyntax_ext/test.rs b/src/libsyntax_ext/test.rs index 6c7e3e3eb98..a5d5ceb4b4f 100644 --- a/src/libsyntax_ext/test.rs +++ b/src/libsyntax_ext/test.rs @@ -285,7 +285,7 @@ fn has_test_signature(cx: &ExtCtxt<'_>, i: &ast::Item) -> bool { // type implements the `Termination` trait as `libtest` enforces that. let has_output = match decl.output { ast::FunctionRetTy::Default(..) => false, - ast::FunctionRetTy::Ty(ref t) if t.node.is_unit() => false, + ast::FunctionRetTy::Ty(ref t) if t.kind.is_unit() => false, _ => true };