about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-06-11 16:48:24 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-06-11 16:48:24 +0200
commitd1931b6406af66520245f1a48de0b79d2d960549 (patch)
tree56f4d61e19fc5b0b1f05cf468cdb6370d0cce98c
parenta7a50b0c0ad7700f3e1e02160d2491290c0fb039 (diff)
downloadrust-d1931b6406af66520245f1a48de0b79d2d960549.tar.gz
rust-d1931b6406af66520245f1a48de0b79d2d960549.zip
Sprinkle inline.
-rw-r--r--compiler/rustc_span/src/def_id.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs
index ae488563ccc..bb4ac22d9c8 100644
--- a/compiler/rustc_span/src/def_id.rs
+++ b/compiler/rustc_span/src/def_id.rs
@@ -308,21 +308,23 @@ impl<D: Decoder> Decodable<D> for LocalDefId {
 rustc_data_structures::define_id_collections!(LocalDefIdMap, LocalDefIdSet, LocalDefId);
 
 impl<CTX: HashStableContext> HashStable<CTX> for DefId {
+    #[inline]
     fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
-        hcx.def_path_hash(*self).hash_stable(hcx, hasher);
+        self.to_stable_hash_key(hcx).hash_stable(hcx, hasher);
     }
 }
 
 impl<CTX: HashStableContext> HashStable<CTX> for LocalDefId {
     #[inline]
     fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
-        hcx.def_path_hash(self.to_def_id()).hash_stable(hcx, hasher);
+        self.to_stable_hash_key(hcx).hash_stable(hcx, hasher);
     }
 }
 
 impl<CTX: HashStableContext> HashStable<CTX> for CrateNum {
+    #[inline]
     fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
-        hcx.def_path_hash(DefId { krate: *self, index: CRATE_DEF_INDEX }).hash_stable(hcx, hasher);
+        self.to_stable_hash_key(hcx).hash_stable(hcx, hasher);
     }
 }
 
@@ -349,7 +351,6 @@ impl<CTX: HashStableContext> ToStableHashKey<CTX> for CrateNum {
 
     #[inline]
     fn to_stable_hash_key(&self, hcx: &CTX) -> DefPathHash {
-        let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX };
-        def_id.to_stable_hash_key(hcx)
+        self.as_def_id().to_stable_hash_key(hcx)
     }
 }