@@ -1234,10 +1234,13 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
12341234 fn process_use_tree ( & mut self ,
12351235 use_tree : & ' l ast:: UseTree ,
12361236 id : NodeId ,
1237- parent_item : & ' l ast:: Item ,
1237+ root_item : & ' l ast:: Item ,
12381238 prefix : & ast:: Path ) {
12391239 let path = & use_tree. prefix ;
1240- let access = access_from ! ( self . save_ctxt, parent_item) ;
1240+ let access = access_from ! ( self . save_ctxt, root_item) ;
1241+ let parent = self . save_ctxt . tcx . hir . opt_local_def_id ( id)
1242+ . and_then ( |id| self . save_ctxt . tcx . parent_def_id ( id) )
1243+ . map ( :: id_from_def_id) ;
12411244
12421245 match use_tree. kind {
12431246 ast:: UseTreeKind :: Simple ( ident) => {
@@ -1276,6 +1279,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
12761279 span,
12771280 name : ident. to_string ( ) ,
12781281 value : String :: new ( ) ,
1282+ parent,
12791283 } ) ;
12801284 }
12811285 self . write_sub_paths_truncated ( & path) ;
@@ -1311,6 +1315,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
13111315 span,
13121316 name : "*" . to_owned ( ) ,
13131317 value : names. join ( ", " ) ,
1318+ parent,
13141319 } ) ;
13151320 }
13161321 self . write_sub_paths ( & path) ;
@@ -1325,7 +1330,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
13251330 span : path. span ,
13261331 } ;
13271332 for & ( ref tree, id) in nested_items {
1328- self . process_use_tree ( tree, id, parent_item , & prefix) ;
1333+ self . process_use_tree ( tree, id, root_item , & prefix) ;
13291334 }
13301335 }
13311336 }
@@ -1400,6 +1405,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc
14001405 span,
14011406 name : item. ident . to_string ( ) ,
14021407 value : String :: new ( ) ,
1408+ parent : None ,
14031409 } ,
14041410 ) ;
14051411 }
0 commit comments