@@ -5,7 +5,7 @@ use crate::hir::{
55 TraitItem , TraitItemId , Ty , VisibilityKind ,
66} ;
77use crate :: hir_id:: { HirId , ItemLocalId } ;
8- use rustc_span:: def_id:: { DefPathHash , LocalDefId } ;
8+ use rustc_span:: def_id:: DefPathHash ;
99
1010/// Requirements for a `StableHashingContext` to be used in this crate.
1111/// This is a hack to allow using the `HashStable_Generic` derive macro
@@ -21,15 +21,14 @@ pub trait HashStableContext:
2121 fn hash_hir_ty ( & mut self , _: & Ty < ' _ > , hasher : & mut StableHasher ) ;
2222 fn hash_hir_visibility_kind ( & mut self , _: & VisibilityKind < ' _ > , hasher : & mut StableHasher ) ;
2323 fn hash_hir_item_like < F : FnOnce ( & mut Self ) > ( & mut self , f : F ) ;
24- fn local_def_path_hash ( & self , def_id : LocalDefId ) -> DefPathHash ;
2524}
2625
2726impl < HirCtx : crate :: HashStableContext > ToStableHashKey < HirCtx > for HirId {
2827 type KeyType = ( DefPathHash , ItemLocalId ) ;
2928
3029 #[ inline]
3130 fn to_stable_hash_key ( & self , hcx : & HirCtx ) -> ( DefPathHash , ItemLocalId ) {
32- let def_path_hash = hcx . local_def_path_hash ( self . owner ) ;
31+ let def_path_hash = self . owner . to_stable_hash_key ( hcx ) ;
3332 ( def_path_hash, self . local_id )
3433 }
3534}
@@ -39,7 +38,7 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ItemId {
3938
4039 #[ inline]
4140 fn to_stable_hash_key ( & self , hcx : & HirCtx ) -> DefPathHash {
42- hcx . local_def_path_hash ( self . def_id )
41+ self . def_id . to_stable_hash_key ( hcx )
4342 }
4443}
4544
@@ -48,7 +47,7 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for TraitItemId {
4847
4948 #[ inline]
5049 fn to_stable_hash_key ( & self , hcx : & HirCtx ) -> DefPathHash {
51- hcx . local_def_path_hash ( self . def_id )
50+ self . def_id . to_stable_hash_key ( hcx )
5251 }
5352}
5453
@@ -57,7 +56,7 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ImplItemId {
5756
5857 #[ inline]
5958 fn to_stable_hash_key ( & self , hcx : & HirCtx ) -> DefPathHash {
60- hcx . local_def_path_hash ( self . def_id )
59+ self . def_id . to_stable_hash_key ( hcx )
6160 }
6261}
6362
@@ -66,7 +65,7 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId
6665
6766 #[ inline]
6867 fn to_stable_hash_key ( & self , hcx : & HirCtx ) -> DefPathHash {
69- hcx . local_def_path_hash ( self . def_id )
68+ self . def_id . to_stable_hash_key ( hcx )
7069 }
7170}
7271
0 commit comments