@@ -23,7 +23,7 @@ use rustc_data_structures::fx::FxHashSet;
2323use std:: path:: Path ;
2424use std:: env;
2525
26- use syntax:: ast:: { self , Attribute , NodeId , PatKind , CRATE_NODE_ID } ;
26+ use syntax:: ast:: { self , Attribute , NodeId , PatKind } ;
2727use syntax:: parse:: token;
2828use syntax:: visit:: { self , Visitor } ;
2929use syntax:: print:: pprust:: {
@@ -82,8 +82,6 @@ pub struct DumpVisitor<'l, 'tcx, 'll> {
8282
8383 span : SpanUtils < ' l > ,
8484
85- cur_scope : NodeId ,
86-
8785 // Set of macro definition (callee) spans, and the set
8886 // of macro use (callsite) spans. We store these to ensure
8987 // we only write one macro def per unique macro definition, and
@@ -103,22 +101,11 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
103101 save_ctxt,
104102 dumper,
105103 span : span_utils,
106- cur_scope : CRATE_NODE_ID ,
107104 // mac_defs: FxHashSet::default(),
108105 // macro_calls: FxHashSet::default(),
109106 }
110107 }
111108
112- fn nest_scope < F > ( & mut self , scope_id : NodeId , f : F )
113- where
114- F : FnOnce ( & mut DumpVisitor < ' l , ' tcx , ' ll > ) ,
115- {
116- let parent_scope = self . cur_scope ;
117- self . cur_scope = scope_id;
118- f ( self ) ;
119- self . cur_scope = parent_scope;
120- }
121-
122109 fn nest_tables < F > ( & mut self , item_id : NodeId , f : F )
123110 where
124111 F : FnOnce ( & mut DumpVisitor < ' l , ' tcx , ' ll > ) ,
@@ -320,7 +307,7 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
320307
321308 // walk the fn body
322309 if let Some ( body) = body {
323- self . nest_tables ( id, |v| v. nest_scope ( id , |v| v . visit_block ( body) ) ) ;
310+ self . nest_tables ( id, |v| v. visit_block ( body) ) ;
324311 }
325312 }
326313
@@ -405,7 +392,7 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
405392 self . visit_ty ( & ret_ty) ;
406393 }
407394
408- self . nest_tables ( item. id , |v| v. nest_scope ( item . id , |v| v . visit_block ( & body) ) ) ;
395+ self . nest_tables ( item. id , |v| v. visit_block ( & body) ) ;
409396 }
410397
411398 fn process_static_or_const_item (
@@ -1349,7 +1336,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
13491336 attributes : lower_attributes ( attrs. to_owned ( ) , & self . save_ctxt ) ,
13501337 } ,
13511338 ) ;
1352- self . nest_scope ( id , |v| visit:: walk_mod ( v , m) ) ;
1339+ visit:: walk_mod ( self , m) ;
13531340 }
13541341
13551342 fn visit_item ( & mut self , item : & ' l ast:: Item ) {
@@ -1404,7 +1391,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
14041391 }
14051392 Mod ( ref m) => {
14061393 self . process_mod ( item) ;
1407- self . nest_scope ( item . id , |v| visit:: walk_mod ( v , m) ) ;
1394+ visit:: walk_mod ( self , m) ;
14081395 }
14091396 Ty ( ref ty, ref ty_params) => {
14101397 let qualname = format ! ( "::{}" ,
@@ -1570,7 +1557,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
15701557 // walk the body
15711558 self . nest_tables ( ex. id , |v| {
15721559 v. process_formals ( & decl. inputs , & id) ;
1573- v. nest_scope ( ex . id , |v| v . visit_expr ( body) )
1560+ v. visit_expr ( body)
15741561 } ) ;
15751562 }
15761563 ast:: ExprKind :: ForLoop ( ref pattern, ref subexpression, ref block, _) => {
0 commit comments