@@ -434,18 +434,22 @@ impl Definitions {
434434 DefPath :: make ( LOCAL_CRATE , index, |p| self . def_key ( p) )
435435 }
436436
437+ #[ inline]
437438 pub fn opt_def_index ( & self , node : ast:: NodeId ) -> Option < DefIndex > {
438439 self . node_to_def_index . get ( & node) . cloned ( )
439440 }
440441
442+ #[ inline]
441443 pub fn opt_local_def_id ( & self , node : ast:: NodeId ) -> Option < DefId > {
442444 self . opt_def_index ( node) . map ( DefId :: local)
443445 }
444446
447+ #[ inline]
445448 pub fn local_def_id ( & self , node : ast:: NodeId ) -> DefId {
446449 self . opt_local_def_id ( node) . unwrap ( )
447450 }
448451
452+ #[ inline]
449453 pub fn as_local_node_id ( & self , def_id : DefId ) -> Option < ast:: NodeId > {
450454 if def_id. krate == LOCAL_CRATE {
451455 let space_index = def_id. index . address_space ( ) . index ( ) ;
@@ -461,6 +465,7 @@ impl Definitions {
461465 }
462466 }
463467
468+ #[ inline]
464469 pub fn node_to_hir_id ( & self , node_id : ast:: NodeId ) -> hir:: HirId {
465470 self . node_to_hir_id [ node_id]
466471 }
@@ -473,6 +478,14 @@ impl Definitions {
473478 . unwrap ( )
474479 }
475480
481+ #[ inline]
482+ pub fn def_index_to_hir_id ( & self , def_index : DefIndex ) -> hir:: HirId {
483+ let space_index = def_index. address_space ( ) . index ( ) ;
484+ let array_index = def_index. as_array_index ( ) ;
485+ let node_id = self . def_index_to_node [ space_index] [ array_index] ;
486+ self . node_to_hir_id [ node_id]
487+ }
488+
476489 /// Add a definition with a parent definition.
477490 pub fn create_root_def ( & mut self ,
478491 crate_name : & str ,
0 commit comments