@@ -308,21 +308,23 @@ impl<D: Decoder> Decodable<D> for LocalDefId {
308
308
rustc_data_structures:: define_id_collections!( LocalDefIdMap , LocalDefIdSet , LocalDefId ) ;
309
309
310
310
impl < CTX : HashStableContext > HashStable < CTX > for DefId {
311
+ #[ inline]
311
312
fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
312
- hcx . def_path_hash ( * self ) . hash_stable ( hcx, hasher) ;
313
+ self . to_stable_hash_key ( hcx ) . hash_stable ( hcx, hasher) ;
313
314
}
314
315
}
315
316
316
317
impl < CTX : HashStableContext > HashStable < CTX > for LocalDefId {
317
318
#[ inline]
318
319
fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
319
- hcx . def_path_hash ( self . to_def_id ( ) ) . hash_stable ( hcx, hasher) ;
320
+ self . to_stable_hash_key ( hcx ) . hash_stable ( hcx, hasher) ;
320
321
}
321
322
}
322
323
323
324
impl < CTX : HashStableContext > HashStable < CTX > for CrateNum {
325
+ #[ inline]
324
326
fn hash_stable ( & self , hcx : & mut CTX , hasher : & mut StableHasher ) {
325
- hcx . def_path_hash ( DefId { krate : * self , index : CRATE_DEF_INDEX } ) . hash_stable ( hcx, hasher) ;
327
+ self . to_stable_hash_key ( hcx ) . hash_stable ( hcx, hasher) ;
326
328
}
327
329
}
328
330
@@ -349,7 +351,6 @@ impl<CTX: HashStableContext> ToStableHashKey<CTX> for CrateNum {
349
351
350
352
#[ inline]
351
353
fn to_stable_hash_key ( & self , hcx : & CTX ) -> DefPathHash {
352
- let def_id = DefId { krate : * self , index : CRATE_DEF_INDEX } ;
353
- def_id. to_stable_hash_key ( hcx)
354
+ self . as_def_id ( ) . to_stable_hash_key ( hcx)
354
355
}
355
356
}
0 commit comments