@@ -206,8 +206,14 @@ pub trait Visitor<'ast>: Sized {
206
206
fn visit_path ( & mut self , path : & ' ast Path , _id : NodeId ) {
207
207
walk_path ( self , path)
208
208
}
209
- fn visit_use_tree ( & mut self , use_tree : & ' ast UseTree , id : NodeId , _nested : bool ) {
210
- walk_use_tree ( self , use_tree, id)
209
+ fn visit_use_tree (
210
+ & mut self ,
211
+ use_tree : & ' ast UseTree ,
212
+ id : NodeId ,
213
+ _nested : bool ,
214
+ item_span : Span ,
215
+ ) {
216
+ walk_use_tree ( self , use_tree, id, item_span)
211
217
}
212
218
fn visit_path_segment ( & mut self , path_segment : & ' ast PathSegment ) {
213
219
walk_path_segment ( self , path_segment)
@@ -307,7 +313,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
307
313
visitor. visit_ident ( item. ident ) ;
308
314
match & item. kind {
309
315
ItemKind :: ExternCrate ( _) => { }
310
- ItemKind :: Use ( use_tree) => visitor. visit_use_tree ( use_tree, item. id , false ) ,
316
+ ItemKind :: Use ( use_tree) => visitor. visit_use_tree ( use_tree, item. id , false , item . span ) ,
311
317
ItemKind :: Static ( box StaticItem { ty, mutability : _, expr } ) => {
312
318
visitor. visit_ty ( ty) ;
313
319
walk_list ! ( visitor, visit_expr, expr) ;
@@ -450,7 +456,12 @@ pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) {
450
456
}
451
457
}
452
458
453
- pub fn walk_use_tree < ' a , V : Visitor < ' a > > ( visitor : & mut V , use_tree : & ' a UseTree , id : NodeId ) {
459
+ pub fn walk_use_tree < ' a , V : Visitor < ' a > > (
460
+ visitor : & mut V ,
461
+ use_tree : & ' a UseTree ,
462
+ id : NodeId ,
463
+ item_span : Span ,
464
+ ) {
454
465
visitor. visit_path ( & use_tree. prefix , id) ;
455
466
match & use_tree. kind {
456
467
UseTreeKind :: Simple ( rename) => {
@@ -462,7 +473,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(visitor: &mut V, use_tree: &'a UseTree,
462
473
UseTreeKind :: Glob => { }
463
474
UseTreeKind :: Nested ( use_trees) => {
464
475
for & ( ref nested_tree, nested_id) in use_trees {
465
- visitor. visit_use_tree ( nested_tree, nested_id, true ) ;
476
+ visitor. visit_use_tree ( nested_tree, nested_id, true , item_span ) ;
466
477
}
467
478
}
468
479
}
0 commit comments