@@ -23,7 +23,7 @@ use rustc_data_structures::fx::FxHashSet;
23
23
use std:: path:: Path ;
24
24
use std:: env;
25
25
26
- use syntax:: ast:: { self , Attribute , NodeId , PatKind , CRATE_NODE_ID } ;
26
+ use syntax:: ast:: { self , Attribute , NodeId , PatKind } ;
27
27
use syntax:: parse:: token;
28
28
use syntax:: visit:: { self , Visitor } ;
29
29
use syntax:: print:: pprust:: {
@@ -82,8 +82,6 @@ pub struct DumpVisitor<'l, 'tcx, 'll> {
82
82
83
83
span : SpanUtils < ' l > ,
84
84
85
- cur_scope : NodeId ,
86
-
87
85
// Set of macro definition (callee) spans, and the set
88
86
// of macro use (callsite) spans. We store these to ensure
89
87
// we only write one macro def per unique macro definition, and
@@ -103,22 +101,11 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
103
101
save_ctxt,
104
102
dumper,
105
103
span : span_utils,
106
- cur_scope : CRATE_NODE_ID ,
107
104
// mac_defs: FxHashSet::default(),
108
105
// macro_calls: FxHashSet::default(),
109
106
}
110
107
}
111
108
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
-
122
109
fn nest_tables < F > ( & mut self , item_id : NodeId , f : F )
123
110
where
124
111
F : FnOnce ( & mut DumpVisitor < ' l , ' tcx , ' ll > ) ,
@@ -320,7 +307,7 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
320
307
321
308
// walk the fn body
322
309
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) ) ;
324
311
}
325
312
}
326
313
@@ -405,7 +392,7 @@ impl<'l, 'tcx, 'll> DumpVisitor<'l, 'tcx, 'll> {
405
392
self . visit_ty ( & ret_ty) ;
406
393
}
407
394
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) ) ;
409
396
}
410
397
411
398
fn process_static_or_const_item (
@@ -1349,7 +1336,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
1349
1336
attributes : lower_attributes ( attrs. to_owned ( ) , & self . save_ctxt ) ,
1350
1337
} ,
1351
1338
) ;
1352
- self . nest_scope ( id , |v| visit:: walk_mod ( v , m) ) ;
1339
+ visit:: walk_mod ( self , m) ;
1353
1340
}
1354
1341
1355
1342
fn visit_item ( & mut self , item : & ' l ast:: Item ) {
@@ -1404,7 +1391,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
1404
1391
}
1405
1392
Mod ( ref m) => {
1406
1393
self . process_mod ( item) ;
1407
- self . nest_scope ( item . id , |v| visit:: walk_mod ( v , m) ) ;
1394
+ visit:: walk_mod ( self , m) ;
1408
1395
}
1409
1396
Ty ( ref ty, ref ty_params) => {
1410
1397
let qualname = format ! ( "::{}" ,
@@ -1570,7 +1557,7 @@ impl<'l, 'tcx, 'll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll> {
1570
1557
// walk the body
1571
1558
self . nest_tables ( ex. id , |v| {
1572
1559
v. process_formals ( & decl. inputs , & id) ;
1573
- v. nest_scope ( ex . id , |v| v . visit_expr ( body) )
1560
+ v. visit_expr ( body)
1574
1561
} ) ;
1575
1562
}
1576
1563
ast:: ExprKind :: ForLoop ( ref pattern, ref subexpression, ref block, _) => {
0 commit comments