]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_passes/ast_validation.rs
Rename `Ty.node` to `Ty.kind`
[rust.git] / src / librustc_passes / ast_validation.rs
index bd46ca4779a430fb56bc5a9bbfae1e9499bfa275..5ccf73290a6329eab665ab375bc48f35092dfd0b 100644 (file)
@@ -107,7 +107,7 @@ fn visit_assoc_ty_constraint_from_generic_args(&mut self, constraint: &'a AssocT
                 // 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 @@ fn visit_ty_from_generic_args(&mut self, ty: &'a Ty) {
         // 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 @@ fn outer_impl_trait(&mut self, span: Span) -> OuterImplTrait {
 
     // 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))
@@ -231,7 +231,7 @@ fn invalid_visibility(&self, vis: &Visibility, note: Option<&str>) {
 
     fn check_decl_no_pat<ReportFn: Fn(Span, bool)>(&self, decl: &FnDecl, report_err: ReportFn) {
         for arg in &decl.inputs {
-            match arg.pat.node {
+            match arg.pat.kind {
                 PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), _, None) |
                 PatKind::Wild => {}
                 PatKind::Ident(BindingMode::ByValue(Mutability::Mutable), _, None) =>
@@ -286,11 +286,11 @@ fn no_questions_in_bounds(&self, bounds: &GenericBounds, where_: &str, is_trait:
     // m!(S);
     // ```
     fn check_expr_within_pat(&self, expr: &Expr, allow_paths: bool) {
-        match expr.node {
+        match expr.kind {
             ExprKind::Lit(..) | ExprKind::Err => {}
             ExprKind::Path(..) if allow_paths => {}
             ExprKind::Unary(UnOp::Neg, ref inner)
-                if match inner.node { ExprKind::Lit(_) => true, _ => false } => {}
+                if match inner.kind { ExprKind::Lit(_) => true, _ => false } => {}
             _ => self.err_handler().span_err(expr.span, "arbitrary expressions aren't allowed \
                                                          in patterns")
         }
@@ -442,7 +442,7 @@ fn validate_generics_order<'a>(
 
 impl<'a> Visitor<'a> for AstValidator<'a> {
     fn visit_expr(&mut self, expr: &'a Expr) {
-        match &expr.node {
+        match &expr.kind {
             ExprKind::Closure(_, _, _, fn_decl, _, _) => {
                 self.check_fn_decl(fn_decl);
             }
@@ -456,7 +456,7 @@ fn visit_expr(&mut self, expr: &'a Expr) {
     }
 
     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 @@ fn visit_item(&mut self, item: &'a Item) {
         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();
@@ -551,7 +551,7 @@ fn visit_item(&mut self, item: &'a Item) {
                 }
                 for impl_item in impl_items {
                     self.invalid_visibility(&impl_item.vis, None);
-                    if let ImplItemKind::Method(ref sig, _) = impl_item.node {
+                    if let ImplItemKind::Method(ref sig, _) = impl_item.kind {
                         self.check_trait_fn_not_const(sig.header.constness);
                         self.check_trait_fn_not_async(impl_item.span, sig.header.asyncness.node);
                     }
@@ -628,7 +628,7 @@ fn visit_item(&mut self, item: &'a Item) {
                 }
                 self.no_questions_in_bounds(bounds, "supertraits", true);
                 for trait_item in trait_items {
-                    if let TraitItemKind::Method(ref sig, ref block) = trait_item.node {
+                    if let TraitItemKind::Method(ref sig, ref block) = trait_item.kind {
                         self.check_fn_decl(&sig.decl);
                         self.check_trait_fn_not_async(trait_item.span, sig.header.asyncness.node);
                         self.check_trait_fn_not_const(sig.header.constness);
@@ -786,7 +786,7 @@ fn visit_generic_param(&mut self, param: &'a GenericParam) {
     }
 
     fn visit_pat(&mut self, pat: &'a Pat) {
-        match pat.node {
+        match pat.kind {
             PatKind::Lit(ref expr) => {
                 self.check_expr_within_pat(expr, false);
             }
@@ -813,8 +813,7 @@ fn visit_poly_trait_ref(&mut self, t: &'a PolyTraitRef, m: &'a TraitBoundModifie
         visit::walk_poly_trait_ref(self, t, m);
     }
 
-    fn visit_variant_data(&mut self, s: &'a VariantData, _: Ident,
-                          _: &'a Generics, _: NodeId, _: Span) {
+    fn visit_variant_data(&mut self, s: &'a VariantData) {
         self.with_banned_assoc_ty_bound(|this| visit::walk_struct_def(this, s))
     }
 
@@ -833,11 +832,8 @@ fn visit_mac(&mut self, mac: &Mac) {
     }
 
     fn visit_impl_item(&mut self, ii: &'a ImplItem) {
-        match ii.node {
-            ImplItemKind::Method(ref sig, _) => {
-                self.check_fn_decl(&sig.decl);
-            }
-            _ => {}
+        if let ImplItemKind::Method(ref sig, _) = ii.kind {
+            self.check_fn_decl(&sig.decl);
         }
         visit::walk_impl_item(self, ii);
     }