@@ -49,7 +49,7 @@ enum PathKind {
4949
5050struct LinkCollector < ' a , ' tcx : ' a , ' rcx : ' a > {
5151 cx : & ' a DocContext < ' a , ' tcx , ' rcx > ,
52- mod_ids : Vec < ast :: NodeId > ,
52+ mod_ids : Vec < hir :: HirId > ,
5353 is_nightly_build : bool ,
5454}
5555
@@ -69,7 +69,7 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
6969 path_str : & str ,
7070 is_val : bool ,
7171 current_item : & Option < String > ,
72- parent_id : Option < ast :: NodeId > )
72+ parent_id : Option < hir :: HirId > )
7373 -> Result < ( Def , Option < String > ) , ( ) >
7474 {
7575 let cx = self . cx ;
@@ -78,8 +78,9 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
7878 // path.
7979 if let Some ( id) = parent_id. or ( self . mod_ids . last ( ) . cloned ( ) ) {
8080 // FIXME: `with_scope` requires the `NodeId` of a module.
81+ let node_id = cx. tcx . hir ( ) . hir_to_node_id ( id) ;
8182 let result = cx. resolver . borrow_mut ( )
82- . with_scope ( id ,
83+ . with_scope ( node_id ,
8384 |resolver| {
8485 resolver. resolve_str_path_error ( DUMMY_SP ,
8586 & path_str, is_val)
@@ -142,8 +143,9 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
142143 }
143144
144145 // FIXME: `with_scope` requires the `NodeId` of a module.
146+ let node_id = cx. tcx . hir ( ) . hir_to_node_id ( id) ;
145147 let ty = cx. resolver . borrow_mut ( )
146- . with_scope ( id ,
148+ . with_scope ( node_id ,
147149 |resolver| {
148150 resolver. resolve_str_path_error ( DUMMY_SP , & path, false )
149151 } ) ?;
@@ -232,11 +234,11 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
232234 } ;
233235
234236 // FIXME: get the resolver to work with non-local resolve scopes.
235- let parent_node = self . cx . as_local_node_id ( item. def_id ) . and_then ( |node_id | {
237+ let parent_node = self . cx . as_local_hir_id ( item. def_id ) . and_then ( |hir_id | {
236238 // FIXME: this fails hard for impls in non-module scope, but is necessary for the
237239 // current `resolve()` implementation.
238- match self . cx . tcx . hir ( ) . get_module_parent_node ( node_id ) {
239- id if id != node_id => Some ( id) ,
240+ match self . cx . tcx . hir ( ) . get_module_parent_node ( hir_id ) {
241+ id if id != hir_id => Some ( id) ,
240242 _ => None ,
241243 }
242244 } ) ;
@@ -255,9 +257,9 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
255257 }
256258 } else {
257259 match parent_node. or ( self . mod_ids . last ( ) . cloned ( ) ) {
258- Some ( parent) if parent != ast :: CRATE_NODE_ID => {
260+ Some ( parent) if parent != hir :: CRATE_HIR_ID => {
259261 // FIXME: can we pull the parent module's name from elsewhere?
260- Some ( self . cx . tcx . hir ( ) . name ( parent) . to_string ( ) )
262+ Some ( self . cx . tcx . hir ( ) . name_by_hir_id ( parent) . to_string ( ) )
261263 }
262264 _ => None ,
263265 }
@@ -274,7 +276,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
274276 } ;
275277
276278 if item. is_mod ( ) && item. attrs . inner_docs {
277- self . mod_ids . push ( self . cx . tcx . hir ( ) . hir_to_node_id ( item_hir_id. unwrap ( ) ) ) ;
279+ self . mod_ids . push ( item_hir_id. unwrap ( ) ) ;
278280 }
279281
280282 let cx = self . cx ;
@@ -421,7 +423,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
421423 }
422424
423425 if item. is_mod ( ) && !item. attrs . inner_docs {
424- self . mod_ids . push ( self . cx . tcx . hir ( ) . hir_to_node_id ( item_hir_id. unwrap ( ) ) ) ;
426+ self . mod_ids . push ( item_hir_id. unwrap ( ) ) ;
425427 }
426428
427429 if item. is_mod ( ) {
0 commit comments