@@ -206,8 +206,14 @@ pub trait Visitor<'ast>: Sized {
206206 fn visit_path ( & mut self , path : & ' ast Path , _id : NodeId ) {
207207 walk_path ( self , path)
208208 }
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)
211217 }
212218 fn visit_path_segment ( & mut self , path_segment : & ' ast PathSegment ) {
213219 walk_path_segment ( self , path_segment)
@@ -307,7 +313,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
307313 visitor. visit_ident ( item. ident ) ;
308314 match & item. kind {
309315 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 ) ,
311317 ItemKind :: Static ( box StaticItem { ty, mutability : _, expr } ) => {
312318 visitor. visit_ty ( ty) ;
313319 walk_list ! ( visitor, visit_expr, expr) ;
@@ -450,7 +456,12 @@ pub fn walk_path<'a, V: Visitor<'a>>(visitor: &mut V, path: &'a Path) {
450456 }
451457}
452458
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+ ) {
454465 visitor. visit_path ( & use_tree. prefix , id) ;
455466 match & use_tree. kind {
456467 UseTreeKind :: Simple ( rename) => {
@@ -462,7 +473,7 @@ pub fn walk_use_tree<'a, V: Visitor<'a>>(visitor: &mut V, use_tree: &'a UseTree,
462473 UseTreeKind :: Glob => { }
463474 UseTreeKind :: Nested ( use_trees) => {
464475 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 ) ;
466477 }
467478 }
468479 }
0 commit comments