Fix rebase fallout

This commit is contained in:
Aaron Hill 2020-11-25 15:08:31 -05:00
parent 6a9dbd2e0e
commit 7a9aa4f980
No known key found for this signature in database
GPG Key ID: B4087E510E98B164
5 changed files with 22 additions and 8 deletions

View File

@ -205,7 +205,10 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
/// If we are not in incremental compilation mode, returns `None`.
/// Otherwise, tries to load the query result cache from disk,
/// creating an empty cache if it could not be loaded.
pub fn load_query_result_cache<'a>(sess: &'a Session, definitions: &Definitions) -> Option<OnDiskCache<'a>> {
pub fn load_query_result_cache<'a>(
sess: &'a Session,
definitions: &Definitions,
) -> Option<OnDiskCache<'a>> {
if sess.opts.incremental.is_none() {
return None;
}
@ -217,7 +220,9 @@ pub fn load_query_result_cache<'a>(sess: &'a Session, definitions: &Definitions)
&query_cache_path(sess),
sess.is_nightly_build(),
) {
LoadResult::Ok { data: (bytes, start_pos) } => Some(OnDiskCache::new(sess, bytes, start_pos, definitions)),
LoadResult::Ok { data: (bytes, start_pos) } => {
Some(OnDiskCache::new(sess, bytes, start_pos, definitions))
}
_ => Some(OnDiskCache::new_empty(sess.source_map())),
}
}

View File

@ -252,8 +252,7 @@ macro_rules! define_dep_nodes {
/// has been removed.
fn extract_def_id(&self, tcx: TyCtxt<'tcx>) -> Option<DefId> {
if self.kind.can_reconstruct_query_key() {
let def_path_hash = DefPathHash(self.hash);
tcx.queries.on_disk_cache.as_ref()?.def_path_hash_to_def_id(tcx, def_path_hash)
tcx.queries.on_disk_cache.as_ref()?.def_path_hash_to_def_id(tcx, DefPathHash(self.hash.into()))
} else {
None
}
@ -326,7 +325,9 @@ 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() {
tcx.queries.on_disk_cache.store_foreign_def_id_hash(*self, hash);
if let Some(cache) = &tcx.queries.on_disk_cache {
cache.store_foreign_def_id_hash(*self, hash);
}
}
hash.0
}

View File

@ -92,7 +92,9 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
type StableHashingContext = StableHashingContext<'tcx>;
fn register_reused_dep_path_hash(&self, hash: DefPathHash) {
self.queries.on_disk_cache.register_reused_dep_path_hash(hash)
if let Some(cache) = self.queries.on_disk_cache.as_ref() {
cache.register_reused_dep_path_hash(hash)
}
}
fn create_stable_hashing_context(&self) -> Self::StableHashingContext {

View File

@ -862,7 +862,13 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for DefId {
// If we get to this point, then all of the query inputs were green,
// which means that the definition with this hash is guaranteed to
// still exist in the current compilation session.
Ok(d.tcx().queries.on_disk_cache.def_path_hash_to_def_id(d.tcx(), def_path_hash).unwrap())
Ok(d.tcx()
.queries
.on_disk_cache
.as_ref()
.unwrap()
.def_path_hash_to_def_id(d.tcx(), def_path_hash)
.unwrap())
}
}

View File

@ -709,7 +709,7 @@ impl<K: DepKind> DepGraph<K> {
// from the old incremental cache into the new cache that we serialize
// and the end of this compilation session.
if dep_node.kind.can_reconstruct_query_key() {
tcx.register_reused_dep_path_hash(DefPathHash(dep_node.hash));
tcx.register_reused_dep_path_hash(DefPathHash(dep_node.hash.into()));
}
// ... emitting any stored diagnostic ...