@@ -219,7 +219,7 @@ impl<'hir> Map<'hir> {
219
219
}
220
220
221
221
pub fn def_path_from_hir_id ( & self , id : HirId ) -> Option < DefPath > {
222
- self . opt_local_def_id_from_hir_id ( id) . map ( |def_id| {
222
+ self . opt_local_def_id ( id) . map ( |def_id| {
223
223
self . def_path ( def_id)
224
224
} )
225
225
}
@@ -230,32 +230,30 @@ impl<'hir> Map<'hir> {
230
230
}
231
231
232
232
#[ inline]
233
- pub fn local_def_id ( & self , node : NodeId ) -> DefId {
234
- self . opt_local_def_id ( node) . unwrap_or_else ( || {
233
+ pub fn local_def_id_from_node_id ( & self , node : NodeId ) -> DefId {
234
+ self . opt_local_def_id_from_node_id ( node) . unwrap_or_else ( || {
235
235
let hir_id = self . node_to_hir_id ( node) ;
236
- bug ! ( "local_def_id : no entry for `{}`, which has a map of `{:?}`" ,
236
+ bug ! ( "local_def_id_from_node_id : no entry for `{}`, which has a map of `{:?}`" ,
237
237
node, self . find_entry( hir_id) )
238
238
} )
239
239
}
240
240
241
- // FIXME(@ljedrz): replace the `NodeId` variant.
242
241
#[ inline]
243
- pub fn local_def_id_from_hir_id ( & self , hir_id : HirId ) -> DefId {
244
- self . opt_local_def_id_from_hir_id ( hir_id) . unwrap_or_else ( || {
245
- bug ! ( "local_def_id_from_hir_id : no entry for `{:?}`, which has a map of `{:?}`" ,
242
+ pub fn local_def_id ( & self , hir_id : HirId ) -> DefId {
243
+ self . opt_local_def_id ( hir_id) . unwrap_or_else ( || {
244
+ bug ! ( "local_def_id : no entry for `{:?}`, which has a map of `{:?}`" ,
246
245
hir_id, self . find_entry( hir_id) )
247
246
} )
248
247
}
249
248
250
- // FIXME(@ljedrz): replace the `NodeId` variant.
251
249
#[ inline]
252
- pub fn opt_local_def_id_from_hir_id ( & self , hir_id : HirId ) -> Option < DefId > {
250
+ pub fn opt_local_def_id ( & self , hir_id : HirId ) -> Option < DefId > {
253
251
let node_id = self . hir_to_node_id ( hir_id) ;
254
252
self . definitions . opt_local_def_id ( node_id)
255
253
}
256
254
257
255
#[ inline]
258
- pub fn opt_local_def_id ( & self , node : NodeId ) -> Option < DefId > {
256
+ pub fn opt_local_def_id_from_node_id ( & self , node : NodeId ) -> Option < DefId > {
259
257
self . definitions . opt_local_def_id ( node)
260
258
}
261
259
@@ -264,7 +262,6 @@ impl<'hir> Map<'hir> {
264
262
self . definitions . as_local_node_id ( def_id)
265
263
}
266
264
267
- // FIXME(@ljedrz): replace the `NodeId` variant.
268
265
#[ inline]
269
266
pub fn as_local_hir_id ( & self , def_id : DefId ) -> Option < HirId > {
270
267
self . definitions . as_local_hir_id ( def_id)
@@ -429,7 +426,7 @@ impl<'hir> Map<'hir> {
429
426
}
430
427
431
428
pub fn body_owner_def_id ( & self , id : BodyId ) -> DefId {
432
- self . local_def_id_from_hir_id ( self . body_owner ( id) )
429
+ self . local_def_id ( self . body_owner ( id) )
433
430
}
434
431
435
432
/// Given a `HirId`, returns the `BodyId` associated with it,
@@ -765,7 +762,7 @@ impl<'hir> Map<'hir> {
765
762
/// Returns the `DefId` of `id`'s nearest module parent, or `id` itself if no
766
763
/// module parent is in this map.
767
764
pub fn get_module_parent ( & self , id : HirId ) -> DefId {
768
- self . local_def_id_from_hir_id ( self . get_module_parent_node ( id) )
765
+ self . local_def_id ( self . get_module_parent_node ( id) )
769
766
}
770
767
771
768
/// Returns the `HirId` of `id`'s nearest module parent, or `id` itself if no
@@ -841,7 +838,7 @@ impl<'hir> Map<'hir> {
841
838
}
842
839
843
840
pub fn get_parent_did ( & self , id : HirId ) -> DefId {
844
- self . local_def_id_from_hir_id ( self . get_parent_item ( id) )
841
+ self . local_def_id ( self . get_parent_item ( id) )
845
842
}
846
843
847
844
pub fn get_foreign_abi ( & self , hir_id : HirId ) -> Abi {
@@ -1247,7 +1244,7 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId, include_id: bool) -> String {
1247
1244
// the user-friendly path, otherwise fall back to stringifying DefPath.
1248
1245
crate :: ty:: tls:: with_opt ( |tcx| {
1249
1246
if let Some ( tcx) = tcx {
1250
- let def_id = map. local_def_id_from_hir_id ( id) ;
1247
+ let def_id = map. local_def_id ( id) ;
1251
1248
tcx. def_path_str ( def_id)
1252
1249
} else if let Some ( path) = map. def_path_from_hir_id ( id) {
1253
1250
path. data . into_iter ( ) . map ( |elem| {
0 commit comments