1
Fork 0

Decouple the on-disk cache from the query engine.

This commit is contained in:
Camille GILLOT 2021-01-04 23:38:20 +01:00
parent 49c1b07a9e
commit dab9b89221
7 changed files with 20 additions and 31 deletions

View file

@ -414,10 +414,7 @@ impl DepNodeExt for DepNode {
/// has been removed.
fn extract_def_id(&self, tcx: TyCtxt<'tcx>) -> Option<DefId> {
if self.kind.can_reconstruct_query_key() {
tcx.queries
.on_disk_cache
.as_ref()?
.def_path_hash_to_def_id(tcx, DefPathHash(self.hash.into()))
tcx.on_disk_cache.as_ref()?.def_path_hash_to_def_id(tcx, DefPathHash(self.hash.into()))
} else {
None
}
@ -472,7 +469,7 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId {
// we will use the old DefIndex as an initial guess for
// a lookup into the crate metadata.
if !self.is_local() {
if let Some(cache) = &tcx.queries.on_disk_cache {
if let Some(cache) = &tcx.on_disk_cache {
cache.store_foreign_def_id_hash(*self, hash);
}
}