@@ -38,7 +38,7 @@ pub fn collect_intra_doc_links(krate: Crate, cx: &DocContext<'_>) -> Crate {
3838
3939struct LinkCollector < ' a , ' tcx > {
4040 cx : & ' a DocContext < ' tcx > ,
41- mod_ids : Vec < ast :: NodeId > ,
41+ mod_ids : Vec < hir :: HirId > ,
4242}
4343
4444impl < ' a , ' tcx > LinkCollector < ' a , ' tcx > {
@@ -55,7 +55,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
5555 path_str : & str ,
5656 ns : Namespace ,
5757 current_item : & Option < String > ,
58- parent_id : Option < ast :: NodeId > )
58+ parent_id : Option < hir :: HirId > )
5959 -> Result < ( Def , Option < String > ) , ( ) >
6060 {
6161 let cx = self . cx ;
@@ -64,8 +64,9 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
6464 // path.
6565 if let Some ( id) = parent_id. or ( self . mod_ids . last ( ) . cloned ( ) ) {
6666 // FIXME: `with_scope` requires the `NodeId` of a module.
67+ let node_id = cx. tcx . hir ( ) . hir_to_node_id ( id) ;
6768 let result = cx. enter_resolver ( |resolver| {
68- resolver. with_scope ( id , |resolver| {
69+ resolver. with_scope ( node_id , |resolver| {
6970 resolver. resolve_str_path_error ( DUMMY_SP , & path_str, ns == ValueNS )
7071 } )
7172 } ) ;
@@ -127,7 +128,8 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
127128 }
128129
129130 // FIXME: `with_scope` requires the `NodeId` of a module.
130- let ty = cx. enter_resolver ( |resolver| resolver. with_scope ( id, |resolver| {
131+ let node_id = cx. tcx . hir ( ) . hir_to_node_id ( id) ;
132+ let ty = cx. enter_resolver ( |resolver| resolver. with_scope ( node_id, |resolver| {
131133 resolver. resolve_str_path_error ( DUMMY_SP , & path, false )
132134 } ) ) ?;
133135 match ty. def {
@@ -215,11 +217,11 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
215217 } ;
216218
217219 // FIXME: get the resolver to work with non-local resolve scopes.
218- let parent_node = self . cx . as_local_node_id ( item. def_id ) . and_then ( |node_id | {
220+ let parent_node = self . cx . as_local_hir_id ( item. def_id ) . and_then ( |hir_id | {
219221 // FIXME: this fails hard for impls in non-module scope, but is necessary for the
220222 // current `resolve()` implementation.
221- match self . cx . tcx . hir ( ) . get_module_parent_node ( node_id ) {
222- id if id != node_id => Some ( id) ,
223+ match self . cx . tcx . hir ( ) . get_module_parent_node ( hir_id ) {
224+ id if id != hir_id => Some ( id) ,
223225 _ => None ,
224226 }
225227 } ) ;
@@ -238,9 +240,9 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
238240 }
239241 } else {
240242 match parent_node. or ( self . mod_ids . last ( ) . cloned ( ) ) {
241- Some ( parent) if parent != ast :: CRATE_NODE_ID => {
243+ Some ( parent) if parent != hir :: CRATE_HIR_ID => {
242244 // FIXME: can we pull the parent module's name from elsewhere?
243- Some ( self . cx . tcx . hir ( ) . name ( parent) . to_string ( ) )
245+ Some ( self . cx . tcx . hir ( ) . name_by_hir_id ( parent) . to_string ( ) )
244246 }
245247 _ => None ,
246248 }
@@ -257,7 +259,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
257259 } ;
258260
259261 if item. is_mod ( ) && item. attrs . inner_docs {
260- self . mod_ids . push ( self . cx . tcx . hir ( ) . hir_to_node_id ( item_hir_id. unwrap ( ) ) ) ;
262+ self . mod_ids . push ( item_hir_id. unwrap ( ) ) ;
261263 }
262264
263265 let cx = self . cx ;
@@ -391,7 +393,7 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
391393 }
392394
393395 if item. is_mod ( ) && !item. attrs . inner_docs {
394- self . mod_ids . push ( self . cx . tcx . hir ( ) . hir_to_node_id ( item_hir_id. unwrap ( ) ) ) ;
396+ self . mod_ids . push ( item_hir_id. unwrap ( ) ) ;
395397 }
396398
397399 if item. is_mod ( ) {
0 commit comments