@@ -110,6 +110,7 @@ impl DefPathHash {
110110
111111 /// Builds a new [DefPathHash] with the given [StableCrateId] and
112112 /// `local_hash`, where `local_hash` must be unique within its crate.
113+ #[ inline]
113114 pub fn new ( stable_crate_id : StableCrateId , local_hash : Hash64 ) -> DefPathHash {
114115 DefPathHash ( Fingerprint :: new ( stable_crate_id. 0 , local_hash) )
115116 }
@@ -404,21 +405,21 @@ rustc_data_structures::define_id_collections!(
404405impl < CTX : HashStableContext > HashStable < CTX > for DefId {
405406 #[ inline]
406407 fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
407- self . to_stable_hash_key ( hcx ) . hash_stable ( hcx, hasher) ;
408+ hcx . def_path_hash ( * self ) . hash_stable ( hcx, hasher) ;
408409 }
409410}
410411
411412impl < CTX : HashStableContext > HashStable < CTX > for LocalDefId {
412413 #[ inline]
413414 fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
414- self . to_stable_hash_key ( hcx ) . hash_stable ( hcx, hasher) ;
415+ hcx . def_path_hash ( self . to_def_id ( ) ) . local_hash ( ) . hash_stable ( hcx, hasher) ;
415416 }
416417}
417418
418419impl < CTX : HashStableContext > HashStable < CTX > for CrateNum {
419420 #[ inline]
420421 fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
421- self . to_stable_hash_key ( hcx) . hash_stable ( hcx, hasher) ;
422+ self . as_def_id ( ) . to_stable_hash_key ( hcx) . stable_crate_id ( ) . hash_stable ( hcx, hasher) ;
422423 }
423424}
424425
@@ -464,30 +465,36 @@ macro_rules! typed_def_id {
464465 pub struct $Name( DefId ) ;
465466
466467 impl $Name {
468+ #[ inline]
467469 pub const fn new_unchecked( def_id: DefId ) -> Self {
468470 Self ( def_id)
469471 }
470472
473+ #[ inline]
471474 pub fn to_def_id( self ) -> DefId {
472475 self . into( )
473476 }
474477
478+ #[ inline]
475479 pub fn is_local( self ) -> bool {
476480 self . 0 . is_local( )
477481 }
478482
483+ #[ inline]
479484 pub fn as_local( self ) -> Option <$LocalName> {
480485 self . 0 . as_local( ) . map( $LocalName:: new_unchecked)
481486 }
482487 }
483488
484489 impl From <$LocalName> for $Name {
490+ #[ inline]
485491 fn from( local: $LocalName) -> Self {
486492 Self ( local. 0 . to_def_id( ) )
487493 }
488494 }
489495
490496 impl From <$Name> for DefId {
497+ #[ inline]
491498 fn from( typed: $Name) -> Self {
492499 typed. 0
493500 }
@@ -500,26 +507,31 @@ macro_rules! typed_def_id {
500507 impl !PartialOrd for $LocalName { }
501508
502509 impl $LocalName {
510+ #[ inline]
503511 pub const fn new_unchecked( def_id: LocalDefId ) -> Self {
504512 Self ( def_id)
505513 }
506514
515+ #[ inline]
507516 pub fn to_def_id( self ) -> DefId {
508517 self . 0 . into( )
509518 }
510519
520+ #[ inline]
511521 pub fn to_local_def_id( self ) -> LocalDefId {
512522 self . 0
513523 }
514524 }
515525
516526 impl From <$LocalName> for LocalDefId {
527+ #[ inline]
517528 fn from( typed: $LocalName) -> Self {
518529 typed. 0
519530 }
520531 }
521532
522533 impl From <$LocalName> for DefId {
534+ #[ inline]
523535 fn from( typed: $LocalName) -> Self {
524536 typed. 0 . into( )
525537 }
0 commit comments