Decouple the on-disk cache from the query engine.
This commit is contained in:
parent
49c1b07a9e
commit
dab9b89221
7 changed files with 20 additions and 31 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
|
|||
type StableHashingContext = StableHashingContext<'tcx>;
|
||||
|
||||
fn register_reused_dep_node(&self, dep_node: &DepNode) {
|
||||
if let Some(cache) = self.queries.on_disk_cache.as_ref() {
|
||||
if let Some(cache) = self.on_disk_cache.as_ref() {
|
||||
cache.register_reused_dep_node(*self, dep_node)
|
||||
}
|
||||
}
|
||||
|
@ -185,15 +185,14 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
|
|||
}
|
||||
|
||||
fn load_diagnostics(&self, prev_dep_node_index: SerializedDepNodeIndex) -> Vec<Diagnostic> {
|
||||
self.queries
|
||||
.on_disk_cache
|
||||
self.on_disk_cache
|
||||
.as_ref()
|
||||
.map(|c| c.load_diagnostics(*self, prev_dep_node_index))
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
fn store_diagnostics(&self, dep_node_index: DepNodeIndex, diagnostics: ThinVec<Diagnostic>) {
|
||||
if let Some(c) = self.queries.on_disk_cache.as_ref() {
|
||||
if let Some(c) = self.on_disk_cache.as_ref() {
|
||||
c.store_diagnostics(dep_node_index, diagnostics)
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +202,7 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
|
|||
dep_node_index: DepNodeIndex,
|
||||
diagnostics: ThinVec<Diagnostic>,
|
||||
) {
|
||||
if let Some(c) = self.queries.on_disk_cache.as_ref() {
|
||||
if let Some(c) = self.on_disk_cache.as_ref() {
|
||||
c.store_diagnostics_for_anon_node(dep_node_index, diagnostics)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue