Skip to content

Commit e4c31de

Browse files
committed
nit: cache crate-hash for next time
1 parent c981001 commit e4c31de

File tree

1 file changed

+5
-0
lines changed
  • src/librustc_incremental/persist

1 file changed

+5
-0
lines changed

src/librustc_incremental/persist/hash.rs

+5
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
8686
// krate; in that case, we just use the krate's overall hash
8787
if let Some(&hash) = self.crate_hashes.get(&def_id.krate) {
8888
debug!("metadata_hash: def_id={:?} crate_hash={:?}", def_id, hash);
89+
90+
// micro-"optimization": avoid a cache miss if we ask
91+
// for metadata from this particular def-id again.
92+
self.item_metadata_hashes.insert(def_id, hash.as_u64());
93+
8994
return hash.as_u64();
9095
}
9196

0 commit comments

Comments
 (0)