Skip to content

Commit

Permalink
Sprinkle inline.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Jun 11, 2021
1 parent a7a50b0 commit d1931b6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions compiler/rustc_span/src/def_id.rs
Expand Up @@ -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);
}
}

Expand All @@ -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)
}
}

0 comments on commit d1931b6

Please sign in to comment.