]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/middle/resolve_lifetime.rs
Fill in some missing parts in the default HIR visitor
[rust.git] / src / librustc / middle / resolve_lifetime.rs
index 6fbdd90217658da22026411a8a14a6a95589dedb..d9398a1c58cd9a65ca4f9dd8822d03f519889e4f 100644 (file)
@@ -195,7 +195,6 @@ fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v hir::FnDecl,
     fn visit_ty(&mut self, ty: &hir::Ty) {
         match ty.node {
             hir::TyBareFn(ref c) => {
-                visit::walk_lifetime_decls_helper(self, &c.lifetimes);
                 self.with(LateScope(&c.lifetimes, self.scope), |old_scope, this| {
                     // a bare fn has no bounds, so everything
                     // contained within is scoped within its binder.
@@ -245,7 +244,7 @@ fn visit_block(&mut self, b: &hir::Block) {
                   |_, this| visit::walk_block(this, b));
     }
 
-    fn visit_lifetime_ref(&mut self, lifetime_ref: &hir::Lifetime) {
+    fn visit_lifetime(&mut self, lifetime_ref: &hir::Lifetime) {
         if lifetime_ref.name == special_idents::static_lifetime.name {
             self.insert_lifetime(lifetime_ref, DefStaticRegion);
             return;
@@ -255,7 +254,7 @@ fn visit_lifetime_ref(&mut self, lifetime_ref: &hir::Lifetime) {
 
     fn visit_generics(&mut self, generics: &hir::Generics) {
         for ty_param in generics.ty_params.iter() {
-            visit::walk_ty_param_bounds_helper(self, &ty_param.bounds);
+            walk_list!(self, visit_ty_param_bound, &ty_param.bounds);
             match ty_param.default {
                 Some(ref ty) => self.visit_ty(&**ty),
                 None => {}
@@ -273,22 +272,22 @@ fn visit_generics(&mut self, generics: &hir::Generics) {
                                                |old_scope, this| {
                             this.check_lifetime_defs(old_scope, bound_lifetimes);
                             this.visit_ty(&**bounded_ty);
-                            visit::walk_ty_param_bounds_helper(this, bounds);
+                            walk_list!(this, visit_ty_param_bound, bounds);
                         });
                         self.trait_ref_hack = false;
                         result
                     } else {
                         self.visit_ty(&**bounded_ty);
-                        visit::walk_ty_param_bounds_helper(self, bounds);
+                        walk_list!(self, visit_ty_param_bound, bounds);
                     }
                 }
                 &hir::WherePredicate::RegionPredicate(hir::WhereRegionPredicate{ref lifetime,
                                                                                 ref bounds,
                                                                                 .. }) => {
 
-                    self.visit_lifetime_ref(lifetime);
+                    self.visit_lifetime(lifetime);
                     for bound in bounds {
-                        self.visit_lifetime_ref(bound);
+                        self.visit_lifetime(bound);
                     }
                 }
                 &hir::WherePredicate::EqPredicate(hir::WhereEqPredicate{ id,
@@ -799,7 +798,7 @@ fn early_bound_lifetime_names(generics: &hir::Generics) -> Vec<ast::Name> {
             FreeLifetimeCollector { early_bound: &mut early_bound,
                                     late_bound: &mut late_bound };
         for ty_param in generics.ty_params.iter() {
-            visit::walk_ty_param_bounds_helper(&mut collector, &ty_param.bounds);
+            walk_list!(&mut collector, visit_ty_param_bound, &ty_param.bounds);
         }
         for predicate in &generics.where_clause.predicates {
             match predicate {
@@ -807,15 +806,15 @@ fn early_bound_lifetime_names(generics: &hir::Generics) -> Vec<ast::Name> {
                                                                               ref bounded_ty,
                                                                               ..}) => {
                     collector.visit_ty(&**bounded_ty);
-                    visit::walk_ty_param_bounds_helper(&mut collector, bounds);
+                    walk_list!(&mut collector, visit_ty_param_bound, bounds);
                 }
                 &hir::WherePredicate::RegionPredicate(hir::WhereRegionPredicate{ref lifetime,
                                                                                 ref bounds,
                                                                                 ..}) => {
-                    collector.visit_lifetime_ref(lifetime);
+                    collector.visit_lifetime(lifetime);
 
                     for bound in bounds {
-                        collector.visit_lifetime_ref(bound);
+                        collector.visit_lifetime(bound);
                     }
                 }
                 &hir::WherePredicate::EqPredicate(_) => unimplemented!()
@@ -843,7 +842,7 @@ struct FreeLifetimeCollector<'a> {
     }
 
     impl<'a, 'v> Visitor<'v> for FreeLifetimeCollector<'a> {
-        fn visit_lifetime_ref(&mut self, lifetime_ref: &hir::Lifetime) {
+        fn visit_lifetime(&mut self, lifetime_ref: &hir::Lifetime) {
             shuffle(self.early_bound, self.late_bound,
                     lifetime_ref.name);
         }