@@ -49,7 +49,7 @@ enum PathKind {
49
49
50
50
struct LinkCollector < ' a , ' tcx : ' a , ' rcx : ' a > {
51
51
cx : & ' a DocContext < ' a , ' tcx , ' rcx > ,
52
- mod_ids : Vec < ast :: NodeId > ,
52
+ mod_ids : Vec < hir :: HirId > ,
53
53
is_nightly_build : bool ,
54
54
}
55
55
@@ -69,7 +69,7 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
69
69
path_str : & str ,
70
70
is_val : bool ,
71
71
current_item : & Option < String > ,
72
- parent_id : Option < ast :: NodeId > )
72
+ parent_id : Option < hir :: HirId > )
73
73
-> Result < ( Def , Option < String > ) , ( ) >
74
74
{
75
75
let cx = self . cx ;
@@ -78,8 +78,9 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
78
78
// path.
79
79
if let Some ( id) = parent_id. or ( self . mod_ids . last ( ) . cloned ( ) ) {
80
80
// FIXME: `with_scope` requires the `NodeId` of a module.
81
+ let node_id = cx. tcx . hir ( ) . hir_to_node_id ( id) ;
81
82
let result = cx. resolver . borrow_mut ( )
82
- . with_scope ( id ,
83
+ . with_scope ( node_id ,
83
84
|resolver| {
84
85
resolver. resolve_str_path_error ( DUMMY_SP ,
85
86
& path_str, is_val)
@@ -142,8 +143,9 @@ impl<'a, 'tcx, 'rcx> LinkCollector<'a, 'tcx, 'rcx> {
142
143
}
143
144
144
145
// FIXME: `with_scope` requires the `NodeId` of a module.
146
+ let node_id = cx. tcx . hir ( ) . hir_to_node_id ( id) ;
145
147
let ty = cx. resolver . borrow_mut ( )
146
- . with_scope ( id ,
148
+ . with_scope ( node_id ,
147
149
|resolver| {
148
150
resolver. resolve_str_path_error ( DUMMY_SP , & path, false )
149
151
} ) ?;
@@ -232,11 +234,11 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
232
234
} ;
233
235
234
236
// 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 | {
236
238
// FIXME: this fails hard for impls in non-module scope, but is necessary for the
237
239
// 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) ,
240
242
_ => None ,
241
243
}
242
244
} ) ;
@@ -255,9 +257,9 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
255
257
}
256
258
} else {
257
259
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 => {
259
261
// 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 ( ) )
261
263
}
262
264
_ => None ,
263
265
}
@@ -274,7 +276,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
274
276
} ;
275
277
276
278
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 ( ) ) ;
278
280
}
279
281
280
282
let cx = self . cx ;
@@ -421,7 +423,7 @@ impl<'a, 'tcx, 'rcx> DocFolder for LinkCollector<'a, 'tcx, 'rcx> {
421
423
}
422
424
423
425
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 ( ) ) ;
425
427
}
426
428
427
429
if item. is_mod ( ) {
0 commit comments