]> git.lizzy.rs Git - rust.git/commitdiff
Split nested_visit_mode function off from nested_visit_map
authorFlorian Diebold <flodiebold@gmail.com>
Thu, 24 Nov 2016 19:15:11 +0000 (20:15 +0100)
committerFlorian Diebold <florian.diebold@freiheit.com>
Tue, 29 Nov 2016 12:04:27 +0000 (13:04 +0100)
... and make the latter mandatory to implement.

35 files changed:
src/librustc/hir/intravisit.rs
src/librustc/hir/map/collector.rs
src/librustc/hir/map/def_collector.rs
src/librustc/lint/context.rs
src/librustc/middle/dataflow.rs
src/librustc/middle/dead.rs
src/librustc/middle/effect.rs
src/librustc/middle/intrinsicck.rs
src/librustc/middle/liveness.rs
src/librustc/middle/reachable.rs
src/librustc/middle/region.rs
src/librustc/middle/resolve_lifetime.rs
src/librustc/middle/stability.rs
src/librustc/middle/weak_lang_items.rs
src/librustc_borrowck/borrowck/gather_loans/mod.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_const_eval/check_match.rs
src/librustc_incremental/calculate_svh/mod.rs
src/librustc_incremental/calculate_svh/svh_visitor.rs
src/librustc_metadata/astencode.rs
src/librustc_metadata/encoder.rs
src/librustc_mir/mir_map.rs
src/librustc_passes/consts.rs
src/librustc_passes/hir_stats.rs
src/librustc_passes/loops.rs
src/librustc_passes/rvalues.rs
src/librustc_passes/static_recursion.rs
src/librustc_privacy/lib.rs
src/librustc_trans/symbol_names_test.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/upvar.rs
src/librustc_typeck/check/wfcheck.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/collect.rs

index b5a6ba3555dd15edc3a841db00447163937dc328..dcdba57fc719dcb05ebc8f5c765edb0a2a4c4b1e 100644 (file)
@@ -95,14 +95,13 @@ pub trait Visitor<'v> : Sized {
     ///////////////////////////////////////////////////////////////////////////
     // Nested items.
 
-    /// The default versions of the `visit_nested_XXX` routines invoke
-    /// this method to get a map to use; if they get back `None`, they
-    /// just skip nested things. Otherwise, they will lookup the
-    /// nested item-like things in the map and visit it. So the best
-    /// way to implement a nested visitor is to override this method
-    /// to return a `Map`; one advantage of this is that if we add
-    /// more types of nested things in the future, they will
-    /// automatically work.
+    /// The default versions of the `visit_nested_XXX` routines invoke this
+    /// method to get a map to use; if they get back `None`, they just skip
+    /// nested things. Otherwise, they will lookup the nested thing in the map
+    /// and visit it depending on what `nested_visit_mode` returns. So the best
+    /// way to implement a nested visitor is to override this method to return a
+    /// `Map`; one advantage of this is that if we add more types of nested
+    /// things in the future, they will automatically work.
     ///
     /// **If for some reason you want the nested behavior, but don't
     /// have a `Map` are your disposal:** then you should override the
@@ -110,8 +109,12 @@ pub trait Visitor<'v> : Sized {
     /// `panic!()`. This way, if a new `visit_nested_XXX` variant is
     /// added in the future, we will see the panic in your code and
     /// fix it appropriately.
-    fn nested_visit_map(&mut self) -> Option<(&Map<'v>, NestedVisitMode)> {
-        None
+    fn nested_visit_map(&mut self) -> Option<&Map<'v>>;
+
+    /// Specifies what things nested things this visitor wants to visit. By
+    /// default, bodies will be visited, but not nested items.
+    fn nested_visit_mode(&mut self) -> NestedVisitMode {
+        NestedVisitMode::OnlyBodies
     }
 
     /// Invoked when a nested item is encountered. By default does
@@ -300,16 +303,15 @@ fn visit_defaultness(&mut self, defaultness: &'v Defaultness) {
 }
 
 fn map_for_body<'v, V: Visitor<'v>>(visitor: &mut V) -> Option<&Map<'v>> {
-    visitor.nested_visit_map().map(|(map, _mode)| map)
+    visitor.nested_visit_map()
 }
 
 fn map_for_item<'v, V: Visitor<'v>>(visitor: &mut V) -> Option<&Map<'v>> {
-    visitor.nested_visit_map().and_then(|(map, mode)| {
-        match mode {
-            NestedVisitMode::OnlyBodies => None,
-            NestedVisitMode::All => Some(map)
-        }
-    })
+    match visitor.nested_visit_mode() {
+        NestedVisitMode::OnlyBodies => None,
+        NestedVisitMode::All => Some(visitor.nested_visit_map()
+                                     .expect("NestedVisitMode::All without nested_visit_map"))
+    }
 }
 
 pub fn walk_opt_name<'v, V: Visitor<'v>>(visitor: &mut V, span: Span, opt_name: Option<Name>) {
@@ -1059,8 +1061,8 @@ pub fn result(&self) -> IdRange {
 }
 
 impl<'a, 'ast> Visitor<'ast> for IdRangeComputingVisitor<'a, 'ast> {
-    fn nested_visit_map(&mut self) -> Option<(&Map<'ast>, NestedVisitMode)> {
-        Some((&self.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&Map<'ast>> {
+        Some(&self.map)
     }
 
     fn visit_id(&mut self, id: NodeId) {
index 524a112561939c52a8dbb2cf15c66d20ed2068f9..2cfb35affc7bf0deb38063e6757e7f35afdfc252 100644 (file)
@@ -10,7 +10,7 @@
 
 use super::*;
 
-use hir::intravisit::{Visitor, NestedVisitMode};
+use hir::intravisit::Visitor;
 use hir::def_id::DefId;
 use middle::cstore::InlinedItem;
 use std::iter::repeat;
@@ -91,7 +91,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> {
     /// deep walking so that we walk nested items in the context of
     /// their outer items.
 
-    fn nested_visit_map(&mut self) -> Option<(&map::Map<'ast>, NestedVisitMode)> {
+    fn nested_visit_map(&mut self) -> Option<&map::Map<'ast>> {
         panic!("visit_nested_xxx must be manually implemented in this visitor")
     }
 
index a6d7c79e34646b1b76c2528403bc21a9a4c82cfc..30445ffe73e28b3e7eeab90140472d707e477fc4 100644 (file)
@@ -327,6 +327,10 @@ fn visit_stmt(&mut self, stmt: &Stmt) {
 
 // We walk the HIR rather than the AST when reading items from metadata.
 impl<'ast> intravisit::Visitor<'ast> for DefCollector<'ast> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
+        None
+    }
+
     fn visit_body(&mut self, id: hir::ExprId) {
         if let Some(krate) = self.hir_crate {
             self.visit_expr(krate.expr(id));
index 799c7e0cc84bcb8d1cb8b7009b99beebbd07199f..0ec2e6641b943b32ccb34b51a8545adef2b2ddcb 100644 (file)
@@ -791,8 +791,12 @@ impl<'a, 'tcx> hir_visit::Visitor<'tcx> for LateContext<'a, 'tcx> {
     /// Because lints are scoped lexically, we want to walk nested
     /// items in the context of the outer item, so enable
     /// deep-walking.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, hir_visit::NestedVisitMode)> {
-        Some((&self.tcx.map, hir_visit::NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
+    }
+
+    fn nested_visit_mode(&mut self) -> hir_visit::NestedVisitMode {
+        hir_visit::NestedVisitMode::All
     }
 
     fn visit_item(&mut self, it: &'tcx hir::Item) {
@@ -1109,8 +1113,8 @@ struct IdVisitor<'a, 'b: 'a, 'tcx: 'a+'b> {
 
 // Output any lints that were previously added to the session.
 impl<'a, 'b, 'tcx> hir_visit::Visitor<'tcx> for IdVisitor<'a, 'b, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, hir_visit::NestedVisitMode)> {
-        Some((&self.cx.tcx.map, hir_visit::NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.cx.tcx.map)
     }
 
     fn visit_id(&mut self, id: ast::NodeId) {
index 1ec3d0db8e0aa3a4a57efcc6371a48a70d1c4b75..5fc7d43f48d09b831d33532edba5b756b072fa5a 100644 (file)
@@ -193,6 +193,8 @@ struct Formals<'a> {
         let mut formals = Formals { entry: entry, index: index };
         intravisit::walk_fn_decl(&mut formals, decl);
         impl<'a, 'v> intravisit::Visitor<'v> for Formals<'a> {
+            fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
             fn visit_pat(&mut self, p: &hir::Pat) {
                 self.index.entry(p.id).or_insert(vec![]).push(self.entry);
                 intravisit::walk_pat(self, p)
index 575ac9773a7da22616ecb77927af518e5369f7d5..f96bfb4718eda874c1b4ff3b5ae825f5fc06d43f 100644 (file)
@@ -221,8 +221,8 @@ fn visit_node(&mut self, node: &ast_map::Node<'tcx>) {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_variant_data(&mut self, def: &'tcx hir::VariantData, _: ast::Name,
@@ -510,10 +510,12 @@ impl<'a, 'tcx> Visitor<'tcx> for DeadVisitor<'a, 'tcx> {
     /// on inner functions when the outer function is already getting
     /// an error. We could do this also by checking the parents, but
     /// this is how the code is setup and it seems harmless enough.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         if self.should_warn_about_item(item) {
             self.warn_dead_code(
index 57735b91ac5d68a4a0d82b1859b98980bb20ab6a..8b0432df2f019c7764911001be0a51ee90812b69 100644 (file)
@@ -21,7 +21,7 @@
 use syntax_pos::Span;
 use hir::{self, PatKind};
 use hir::def::Def;
-use hir::intravisit::{self, FnKind, Visitor, NestedVisitMode};
+use hir::intravisit::{self, FnKind, Visitor};
 
 #[derive(Copy, Clone)]
 struct UnsafeContext {
@@ -93,8 +93,8 @@ fn require_unsafe(&mut self, span: Span, description: &str) {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for EffectCheckVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_fn(&mut self, fn_kind: FnKind<'tcx>, fn_decl: &'tcx hir::FnDecl,
index 5673ec05cf9400c184a256d834572c9eb445d1b8..49ada60c57675b17fd58b7b6fa394942850cc55e 100644 (file)
@@ -19,7 +19,7 @@
 use syntax::abi::Abi::RustIntrinsic;
 use syntax::ast;
 use syntax_pos::Span;
-use hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
+use hir::intravisit::{self, Visitor, FnKind};
 use hir;
 
 pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
@@ -117,8 +117,8 @@ fn check_transmute(&self, span: Span, from: Ty<'gcx>, to: Ty<'gcx>, id: ast::Nod
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for ItemVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     // const, static and N in [T; N].
@@ -163,8 +163,8 @@ fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
 }
 
 impl<'a, 'gcx, 'tcx> Visitor<'gcx> for ExprVisitor<'a, 'gcx, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
-        Some((&self.infcx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
+        Some(&self.infcx.tcx.map)
     }
 
     fn visit_expr(&mut self, expr: &'gcx hir::Expr) {
index ca28f1dae291ae7e807da8d48f6530e190e487c8..94f880f9fdff6839b2f1de19b886a9ae6653fd20 100644 (file)
 use hir::Expr;
 use hir;
 use hir::print::{expr_to_string, block_to_string};
-use hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
+use hir::intravisit::{self, Visitor, FnKind};
 
 /// For use with `propagate_through_loop`.
 enum LoopKind<'a> {
@@ -183,8 +183,8 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for IrMaps<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
     fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
                 b: hir::ExprId, s: Span, id: NodeId) {
@@ -352,8 +352,8 @@ fn lnk(&self, ln: LiveNode) -> LiveNodeKind {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.ir.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.ir.tcx.map)
     }
     fn visit_fn(&mut self, _: FnKind<'tcx>, _: &'tcx hir::FnDecl,
                 _: hir::ExprId, _: Span, _: NodeId) {
index f8a1b109d9dbd16671fd37d34aac0d4cb01134a6..31731adc087933ea7933e32d1043e2a5c988615c 100644 (file)
@@ -28,7 +28,7 @@
 use syntax::ast;
 use syntax::attr;
 use hir;
-use hir::intravisit::{Visitor, NestedVisitMode};
+use hir::intravisit::{Visitor};
 use hir::itemlikevisit::ItemLikeVisitor;
 use hir::intravisit;
 
@@ -89,8 +89,8 @@ struct ReachableContext<'a, 'tcx: 'a> {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for ReachableContext<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
index ed777d58c25aa6ddc2ff5912f132030960639147..c2a34fca6e138a9f06a33e8915877265ffb6dd51 100644 (file)
@@ -31,7 +31,7 @@
 use syntax_pos::Span;
 
 use hir;
-use hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
+use hir::intravisit::{self, Visitor, FnKind};
 use hir::{Block, Item, FnDecl, Arm, Pat, PatKind, Stmt, Expr, Local};
 
 #[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
@@ -1170,8 +1170,8 @@ fn create_item_scope_if_needed(&mut self, id: ast::NodeId) {
 }
 
 impl<'ast, 'a> Visitor<'ast> for RegionResolutionVisitor<'ast, 'a> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'ast>, NestedVisitMode)> {
-        Some((&self.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
+        Some(&self.map)
     }
 
     fn visit_block(&mut self, b: &'ast Block) {
index 7b94f9b32d90817f4f65bbe8794989c60decdb04..88877b5a15be263183f64fdc804bba0b74f4fc2e 100644 (file)
@@ -132,10 +132,12 @@ pub fn krate(sess: &Session,
 impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
     // Override the nested functions -- lifetimes follow lexical scope,
     // so it's convenient to walk the tree in lexical order.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.hir_map, NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.hir_map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         // Save labels for nested items.
         let saved_labels_in_fn = replace(&mut self.labels_in_fn, vec![]);
@@ -423,6 +425,8 @@ struct GatherLabels<'a> {
     return;
 
     impl<'v, 'a> Visitor<'v> for GatherLabels<'a> {
+        fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
         fn visit_expr(&mut self, ex: &'v hir::Expr) {
             // do not recurse into closures defined in the block
             // since they are treated as separate fns from the POV of
@@ -938,6 +942,8 @@ struct ConstrainedCollector {
     }
 
     impl<'v> Visitor<'v> for ConstrainedCollector {
+        fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
         fn visit_ty(&mut self, ty: &'v hir::Ty) {
             match ty.node {
                 hir::TyPath(hir::QPath::Resolved(Some(_), _)) |
@@ -975,6 +981,8 @@ struct AllCollector {
     }
 
     impl<'v> Visitor<'v> for AllCollector {
+        fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
         fn visit_lifetime(&mut self, lifetime_ref: &'v hir::Lifetime) {
             self.regions.insert(lifetime_ref.name);
         }
index 7417509e5b78b795b3052d3479fb72264812fc25..33507f12ac43bbbbe218c8ec98a0aea8481349f3 100644 (file)
@@ -234,10 +234,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> {
     /// Because stability levels are scoped lexically, we want to walk
     /// nested items in the context of the outer item, so enable
     /// deep-walking.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
+
     fn visit_item(&mut self, i: &'tcx Item) {
         let orig_in_trait_impl = self.in_trait_impl;
         let mut kind = AnnotationKind::Required;
@@ -534,10 +536,12 @@ pub fn check_stability(self, def_id: DefId, id: NodeId, span: Span) {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::OnlyBodies }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         match item.node {
             hir::ItemExternCrate(_) => {
index 30690c099194f644308b86cff6153a9a8f7a311e..36ce4f98dfdfffc74eb1b4dc5fccdb4cb7451ad8 100644 (file)
@@ -125,6 +125,8 @@ fn register(&mut self, name: &str, span: Span) {
 }
 
 impl<'a, 'v> Visitor<'v> for Context<'a> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
     fn visit_foreign_item(&mut self, i: &hir::ForeignItem) {
         if let Some(lang_item) = lang_items::extract(&i.attrs) {
             self.register(&lang_item.as_str(), i.span);
index 96faf97d609f63dd52d9c4dbfe31dbdc5c93284a..710f47f06c7c572ce82e9a5934c74483f10c107b 100644 (file)
@@ -30,7 +30,7 @@
 use rustc::hir;
 use rustc::hir::Expr;
 use rustc::hir::intravisit;
-use rustc::hir::intravisit::{Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{Visitor};
 
 use self::restrictions::RestrictionResult;
 
@@ -521,8 +521,8 @@ struct StaticInitializerCtxt<'a, 'tcx: 'a> {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for StaticInitializerCtxt<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.bccx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.bccx.tcx.map)
     }
 
     fn visit_expr(&mut self, ex: &'tcx Expr) {
index 2beb62266fb35e180dbca16169eb0e9f06ade56b..dd87b8472e22dcdd8aecbc177847ac8f935e653f 100644 (file)
@@ -47,7 +47,7 @@
 use errors::DiagnosticBuilder;
 
 use rustc::hir;
-use rustc::hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor, FnKind};
 
 pub mod check_loans;
 
@@ -63,8 +63,8 @@
 pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>;
 
 impl<'a, 'tcx> Visitor<'tcx> for BorrowckCtxt<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_fn(&mut self, fk: FnKind<'tcx>, fd: &'tcx hir::FnDecl,
index 6862518067c9773b5144cbc8738dc96005b53586..08116327590d6db73b01e42351f284f66aac3e98 100644 (file)
@@ -29,7 +29,7 @@
 use rustc_errors::DiagnosticBuilder;
 
 use rustc::hir::def::*;
-use rustc::hir::intravisit::{self, Visitor, FnKind, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor, FnKind};
 use rustc::hir::print::pat_to_string;
 use rustc::hir::{self, Pat, PatKind};
 
@@ -42,6 +42,8 @@
 struct OuterVisitor<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx> }
 
 impl<'a, 'tcx> Visitor<'tcx> for OuterVisitor<'a, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> { None }
+
     fn visit_expr(&mut self, _expr: &'tcx hir::Expr) {
         return // const, static and N in [T; N] - shouldn't contain anything
     }
@@ -91,8 +93,8 @@ struct MatchVisitor<'a, 'tcx: 'a> {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for MatchVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
@@ -561,6 +563,8 @@ struct AtBindingPatternVisitor<'a, 'b:'a, 'tcx:'b> {
 }
 
 impl<'a, 'b, 'tcx, 'v> Visitor<'v> for AtBindingPatternVisitor<'a, 'b, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
     fn visit_pat(&mut self, pat: &Pat) {
         match pat.node {
             PatKind::Binding(.., ref subpat) => {
index 01e1f4ca1f13ce77e18a1043d02a565912c25e49..6de7192b17ce44629607c4c9f8be694fc540acc8 100644 (file)
@@ -224,6 +224,8 @@ fn compute_crate_hash(&mut self) {
 
 
 impl<'a, 'tcx> Visitor<'tcx> for HashItemsVisitor<'a, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> { None }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         self.calculate_node_id(item.id, |v| v.visit_item(item));
         visit::walk_item(self, item);
index 6a045216ce9cb24f2d40edf4db3b99845595bbb1..59165649fdecd0ee9789ba84a3fb8a221fd8f5be 100644 (file)
@@ -513,9 +513,9 @@ macro_rules! hash_span {
 }
 
 impl<'a, 'hash, 'tcx> visit::Visitor<'tcx> for StrictVersionHashVisitor<'a, 'hash, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, visit::NestedVisitMode)> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
         if self.hash_bodies {
-            Some((&self.tcx.map, visit::NestedVisitMode::OnlyBodies))
+            Some(&self.tcx.map)
         } else {
             None
         }
index 8a24062f8f35da9d74418f10b8f2d1edbab789c9..52a0dc8a6191d11d5062ef070323730838117306 100644 (file)
@@ -11,7 +11,7 @@
 use rustc::hir;
 use rustc::hir::map as ast_map;
 
-use rustc::hir::intravisit::{Visitor, IdRangeComputingVisitor, IdRange, NestedVisitMode};
+use rustc::hir::intravisit::{Visitor, IdRangeComputingVisitor, IdRange};
 
 use cstore::CrateMetadata;
 use encoder::EncodeContext;
@@ -75,8 +75,8 @@ struct SideTableEncodingIdVisitor<'a, 'b: 'a, 'tcx: 'b> {
 }
 
 impl<'a, 'b, 'tcx> Visitor<'tcx> for SideTableEncodingIdVisitor<'a, 'b, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.ecx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.ecx.tcx.map)
     }
 
     fn visit_id(&mut self, id: ast::NodeId) {
index 67b0be0dfcdac33907d67d03e7f71d5fb81f0dc4..41c8a9728fa2e29e2dd9ff54efde6fef329e76aa 100644 (file)
@@ -39,7 +39,7 @@
 
 use rustc::hir::{self, PatKind};
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
-use rustc::hir::intravisit::{Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{Visitor};
 use rustc::hir::intravisit;
 
 use super::index_builder::{FromId, IndexBuilder, Untracked};
@@ -983,8 +983,8 @@ struct EncodeVisitor<'a, 'b: 'a, 'tcx: 'b> {
 }
 
 impl<'a, 'b, 'tcx> Visitor<'tcx> for EncodeVisitor<'a, 'b, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.index.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.index.tcx.map)
     }
     fn visit_expr(&mut self, ex: &'tcx hir::Expr) {
         intravisit::walk_expr(self, ex);
index 1d362129b1bce7a93357eaeb931ddf847f07ae2c..ecc978542e127cb9de6f86d8a445a55ad524b732 100644 (file)
@@ -30,7 +30,7 @@
 use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::subst::Substs;
 use rustc::hir;
-use rustc::hir::intravisit::{self, FnKind, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, FnKind, Visitor};
 use syntax::abi::Abi;
 use syntax::ast;
 use syntax_pos::Span;
@@ -144,8 +144,8 @@ fn build_const_integer(&mut self, expr: &'gcx hir::Expr) {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for BuildMir<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     // Const and static items.
index 94110ca58f8561327c84e54031ee7166e2c13d02..5946c3840e47178b17c879668b08500b952716c2 100644 (file)
@@ -48,7 +48,7 @@
 use rustc::hir::{self, PatKind};
 use syntax::ast;
 use syntax_pos::Span;
-use rustc::hir::intravisit::{self, FnKind, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, FnKind, Visitor};
 
 use std::collections::hash_map::Entry;
 use std::cmp::Ordering;
@@ -233,8 +233,8 @@ fn record_borrow(&mut self, id: ast::NodeId, mutbl: hir::Mutability) {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for CheckCrateVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_item(&mut self, i: &'tcx hir::Item) {
index 28a913de26fe6b41270614e1162cd1530fff9f59..8c51a50526c7dc72e3eec9568032ac0f856209ed 100644 (file)
@@ -106,7 +106,7 @@ fn print(&self, title: &str) {
 }
 
 impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'v>, hir_visit::NestedVisitMode)> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> {
         panic!("visit_nested_xxx must be manually implemented in this visitor")
     }
 
index 9356a0ce17d67718650f99f2db8e3b3c37c0b916..a2c261a36a606dbc051f79bacf8bd868598a6fe9 100644 (file)
@@ -13,7 +13,7 @@
 
 use rustc::dep_graph::DepNode;
 use rustc::hir::map::Map;
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir;
 use syntax::ast;
 use syntax_pos::Span;
@@ -60,8 +60,8 @@ pub fn check_crate(sess: &Session, map: &Map) {
 }
 
 impl<'a, 'ast> Visitor<'ast> for CheckLoopVisitor<'a, 'ast> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'ast>, NestedVisitMode)> {
-        Some((&self.hir_map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
+        Some(&self.map)
     }
 
     fn visit_item(&mut self, i: &'ast hir::Item) {
index 36492538d4bfbeaca8aed5a52897010427638fdf..3e2b2b62fa822566e1590da07a8256819cb369e0 100644 (file)
@@ -18,7 +18,7 @@
 use rustc::traits::Reveal;
 
 use rustc::hir;
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use syntax::ast;
 use syntax_pos::Span;
 
@@ -32,8 +32,8 @@ struct RvalueContext<'a, 'tcx: 'a> {
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for RvalueContext<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_fn(&mut self,
index a70ad25f50545ab9ecd620832767cbabe82f3088..f8d7e100dabf125aeda1017dad151b239119eb77 100644 (file)
@@ -20,7 +20,7 @@
 use syntax::ast;
 use syntax::feature_gate::{GateIssue, emit_feature_err};
 use syntax_pos::Span;
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir;
 
 use std::cell::RefCell;
@@ -36,6 +36,8 @@ struct CheckCrateVisitor<'a, 'ast: 'a> {
 }
 
 impl<'a, 'ast: 'a> Visitor<'ast> for CheckCrateVisitor<'a, 'ast> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> { None }
+
     fn visit_item(&mut self, it: &'ast hir::Item) {
         match it.node {
             hir::ItemStatic(..) |
@@ -200,8 +202,8 @@ fn populate_enum_discriminants(&self, enum_definition: &'ast hir::EnumDef) {
 }
 
 impl<'a, 'ast: 'a> Visitor<'ast> for CheckItemRecursionVisitor<'a, 'ast> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'ast>, NestedVisitMode)> {
-        Some((&self.ast_map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'ast>> {
+        Some(&self.ast_map)
     }
 
     fn visit_item(&mut self, it: &'ast hir::Item) {
index eb742b87889814f49022599c96e8b2597b8d3172..644f681a6dac3c6f63ed8d7e7f0199441b620bc3 100644 (file)
@@ -120,10 +120,12 @@ fn reach<'b>(&'b mut self, item_id: ast::NodeId)
 impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
     /// We want to visit items in the context of their containing
     /// module and so forth, so supply a crate for doing a deep walk.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         let inherited_item_level = match item.node {
             // Impls inherit level from their types and traits
@@ -432,10 +434,12 @@ fn check_method(&mut self, span: Span, method_def_id: DefId) {
 impl<'a, 'tcx> Visitor<'tcx> for PrivacyVisitor<'a, 'tcx> {
     /// We want to visit items in the context of their containing
     /// module and so forth, so supply a crate for doing a deep walk.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         let orig_curitem = replace(&mut self.curitem, item.id);
         intravisit::walk_item(self, item);
@@ -615,6 +619,8 @@ fn item_is_public(&self, id: &ast::NodeId, vis: &hir::Visibility) -> bool {
 }
 
 impl<'a, 'b, 'tcx, 'v> Visitor<'v> for ObsoleteCheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
     fn visit_ty(&mut self, ty: &hir::Ty) {
         if let hir::TyPath(hir::QPath::Resolved(_, ref path)) = ty.node {
             if self.inner.path_is_private_type(path) {
@@ -640,10 +646,12 @@ fn visit_expr(&mut self, _: &hir::Expr) {}
 impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
     /// We want to visit items in the context of their containing
     /// module and so forth, so supply a crate for doing a deep walk.
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::All))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.tcx.map)
     }
 
+    fn nested_visit_mode(&mut self) -> NestedVisitMode { NestedVisitMode::All }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         match item.node {
             // contents of a private mod can be reexported, so we need
index aa23a1817227657f8e71aad3d0051ca8ae4c8082..bdd8d00acd41fc92be3f3077d6ca55628ec7f57c 100644 (file)
@@ -67,6 +67,8 @@ fn process_attrs(&mut self,
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for SymbolNamesTest<'a, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> { None }
+
     fn visit_item(&mut self, item: &'tcx hir::Item) {
         self.process_attrs(item.id);
         intravisit::walk_item(self, item);
index cb9d098d2a527b9f39e4695c5df5b9b9cddaecd8..2909f9210095b69780a74440fdb20db713bfa52a 100644 (file)
 use syntax::util::lev_distance::find_best_match_for_name;
 use syntax_pos::{self, BytePos, Span};
 
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir::itemlikevisit::ItemLikeVisitor;
 use rustc::hir::{self, PatKind};
 use rustc::hir::print as pprust;
@@ -538,8 +538,8 @@ struct CheckItemTypesVisitor<'a, 'tcx: 'a> { ccx: &'a CrateCtxt<'a, 'tcx> }
 struct CheckItemBodiesVisitor<'a, 'tcx: 'a> { ccx: &'a CrateCtxt<'a, 'tcx> }
 
 impl<'a, 'tcx> Visitor<'tcx> for CheckItemTypesVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.ccx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.ccx.tcx.map)
     }
 
     fn visit_item(&mut self, i: &'tcx hir::Item) {
@@ -700,6 +700,8 @@ fn assign(&mut self, _span: Span, nid: ast::NodeId, ty_opt: Option<Ty<'tcx>>) ->
 }
 
 impl<'a, 'gcx, 'tcx> Visitor<'gcx> for GatherLocalsVisitor<'a, 'gcx, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> { None }
+
     // Add explicitly-declared locals.
     fn visit_local(&mut self, local: &'gcx hir::Local) {
         let o_ty = match local.ty {
index 2540faa98369fd11239232cf1bb2563712f9df85..3d39aed2e16d89c93af3739d4055aeb01a00dd23 100644 (file)
@@ -99,7 +99,7 @@
 use std::ops::Deref;
 use syntax::ast;
 use syntax_pos::Span;
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir::{self, PatKind};
 
 use self::SubjectNode::Subject;
@@ -480,8 +480,8 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for RegionCtxt<'a, 'gcx, 'tcx> {
     // hierarchy, and in particular the relationships between free
     // regions, until regionck, as described in #3238.
 
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
-        Some((&self.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
+        Some(&self.tcx.map)
     }
 
     fn visit_fn(&mut self, _fk: intravisit::FnKind<'gcx>, fd: &'gcx hir::FnDecl,
index 796d3016b0bb1315ae433f649c15ec9a81c9840f..92432c0e55f8afaf2a041ab9ba7ffbc7798660de 100644 (file)
@@ -50,7 +50,7 @@
 use syntax::ast;
 use syntax_pos::Span;
 use rustc::hir;
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::util::nodemap::NodeMap;
 
 ///////////////////////////////////////////////////////////////////////////
@@ -78,8 +78,8 @@ struct SeedBorrowKind<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
 }
 
 impl<'a, 'gcx, 'tcx> Visitor<'gcx> for SeedBorrowKind<'a, 'gcx, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
-        Some((&self.fcx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
+        Some(&self.fcx.tcx.map)
     }
 
     fn visit_expr(&mut self, expr: &'gcx hir::Expr) {
@@ -490,8 +490,8 @@ fn adjust_closure_kind(&mut self,
 }
 
 impl<'a, 'gcx, 'tcx> Visitor<'gcx> for AdjustBorrowKind<'a, 'gcx, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
-        Some((&self.fcx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
+        Some(&self.fcx.tcx.map)
     }
 
     fn visit_fn(&mut self,
index ef3ac5da6cc4aca1d6b8c1dd6bc6f55b0b36dd3a..bb06847f7bed8ca30e9c1471be6ba557ed4ebd91 100644 (file)
@@ -609,6 +609,8 @@ fn reject_shadowing_type_parameters(tcx: TyCtxt, span: Span, def_id: DefId) {
 }
 
 impl<'ccx, 'tcx, 'v> Visitor<'v> for CheckTypeWellFormedVisitor<'ccx, 'tcx> {
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'v>> { None }
+
     fn visit_item(&mut self, i: &hir::Item) {
         debug!("visit_item: {:?}", i);
         self.check_item_well_formed(i);
index 3906722aaab38c5925759087dbb282911fffd3fa..6f95a3da29ed7afe48c56223a043527372a497b4 100644 (file)
@@ -27,7 +27,7 @@
 use syntax_pos::{DUMMY_SP, Span};
 
 use rustc::hir::print::pat_to_string;
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir::{self, PatKind};
 
 ///////////////////////////////////////////////////////////////////////////
@@ -187,8 +187,8 @@ fn fix_scalar_binary_expr(&mut self, e: &hir::Expr) {
 // traffic in node-ids or update tables in the type context etc.
 
 impl<'cx, 'gcx, 'tcx> Visitor<'gcx> for WritebackCx<'cx, 'gcx, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'gcx>, NestedVisitMode)> {
-        Some((&self.fcx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'gcx>> {
+        Some(&self.fcx.tcx.map)
     }
 
     fn visit_stmt(&mut self, s: &'gcx hir::Stmt) {
index 09e54cb9c5366ea34b502dc713fd6a95a13a3852..0ae0d8942955a75a753f6c250e8f1d53d952ba49 100644 (file)
@@ -83,7 +83,7 @@
 use syntax_pos::Span;
 
 use rustc::hir::{self, map as hir_map, print as pprust};
-use rustc::hir::intravisit::{self, Visitor, NestedVisitMode};
+use rustc::hir::intravisit::{self, Visitor};
 use rustc::hir::def::{Def, CtorKind};
 use rustc::hir::def_id::DefId;
 
@@ -178,8 +178,8 @@ fn with_collect_item_sig<OP>(&self, id: ast::NodeId, op: OP)
 }
 
 impl<'a, 'tcx> Visitor<'tcx> for CollectItemTypesVisitor<'a, 'tcx> {
-    fn nested_visit_map(&mut self) -> Option<(&hir::map::Map<'tcx>, NestedVisitMode)> {
-        Some((&self.ccx.tcx.map, NestedVisitMode::OnlyBodies))
+    fn nested_visit_map(&mut self) -> Option<&hir::map::Map<'tcx>> {
+        Some(&self.ccx.tcx.map)
     }
 
     fn visit_item(&mut self, item: &'tcx hir::Item) {