about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2019-07-26 18:30:32 -0400
committerMark Rousskov <mark.simulacrum@gmail.com>2019-07-27 19:27:48 -0400
commita6d6eea4c8ac8b9bd97ecd466418ee739a9a97fa (patch)
treec30719af38b084459828e2b94c024062530c4f64
parentc798dffac9dc8c82374db48f5b474690cc6e9686 (diff)
downloadrust-a6d6eea4c8ac8b9bd97ecd466418ee739a9a97fa.tar.gz
rust-a6d6eea4c8ac8b9bd97ecd466418ee739a9a97fa.zip
Remove unused scope tracking
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 2b349613dc5..062033304ee 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -23,7 +23,7 @@ use rustc_data_structures::fx::FxHashSet;
 use std::path::Path;
 use std::env;
 
-use syntax::ast::{self, Attribute, NodeId, PatKind, CRATE_NODE_ID};
+use syntax::ast::{self, Attribute, NodeId, PatKind};
 use syntax::parse::token;
 use syntax::visit::{self, Visitor};
 use syntax::print::pprust::{
@@ -82,8 +82,6 @@ pub struct DumpVisitor<'l, 'tcx, 'll> {
 
     span: SpanUtils<'l>,
 
-    cur_scope: NodeId,
-
     // Set of macro definition (callee) spans, and the set
     // of macro use (callsite) spans. We store these to ensure
     // we only write one macro def per unique macro definition, and
@@ -103,22 +101,11 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
             save_ctxt,
             dumper,
             span: span_utils,
-            cur_scope: CRATE_NODE_ID,
             // mac_defs: FxHashSet::default(),
             // macro_calls: FxHashSet::default(),
         }
     }
 
-    fn nest_scope<F>(&mut self, scope_id: NodeId, f: F)
-    where
-        F: FnOnce(&mut DumpVisitor<'l, 'tcx, 'll>),
-    {
-        let parent_scope = self.cur_scope;
-        self.cur_scope = scope_id;
-        f(self);
-        self.cur_scope = parent_scope;
-    }
-
     fn nest_tables<F>(&mut self, item_id: NodeId, f: F)
     where
         F: FnOnce(&mut DumpVisitor<'l, 'tcx, 'll>),
@@ -320,7 +307,7 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
 
         // walk the fn body
         if let Some(body) = body {
-            self.nest_tables(id, |v| v.nest_scope(id, |v| v.visit_block(body)));
+            self.nest_tables(id, |v| v.visit_block(body));
         }
     }
 
@@ -405,7 +392,7 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
             self.visit_ty(&ret_ty);
         }
 
-        self.nest_tables(item.id, |v| v.nest_scope(item.id, |v| v.visit_block(&body)));
+        self.nest_tables(item.id, |v| v.visit_block(&body));
     }
 
     fn process_static_or_const_item(
@@ -1349,7 +1336,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
                 attributes: lower_attributes(attrs.to_owned(), &self.save_ctxt),
             },
         );
-        self.nest_scope(id, |v| visit::walk_mod(v, m));
+        visit::walk_mod(self, m);
     }
 
     fn visit_item(&mut self, item: &'l ast::Item) {
@@ -1404,7 +1391,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
             }
             Mod(ref m) => {
                 self.process_mod(item);
-                self.nest_scope(item.id, |v| visit::walk_mod(v, m));
+                visit::walk_mod(self, m);
             }
             Ty(ref ty, ref ty_params) => {
                 let qualname = format!("::{}",
@@ -1570,7 +1557,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
                 // walk the body
                 self.nest_tables(ex.id, |v| {
                     v.process_formals(&decl.inputs, &id);
-                    v.nest_scope(ex.id, |v| v.visit_expr(body))
+                    v.visit_expr(body)
                 });
             }
             ast::ExprKind::ForLoop(ref pattern, ref subexpression, ref block, _) => {