Skip to content

Commit 7a9aa4f

Browse files
committed
Fix rebase fallout
1 parent 6a9dbd2 commit 7a9aa4f

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

compiler/rustc_incremental/src/persist/load.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
205205
/// If we are not in incremental compilation mode, returns `None`.
206206
/// Otherwise, tries to load the query result cache from disk,
207207
/// creating an empty cache if it could not be loaded.
208-
pub fn load_query_result_cache<'a>(sess: &'a Session, definitions: &Definitions) -> Option<OnDiskCache<'a>> {
208+
pub fn load_query_result_cache<'a>(
209+
sess: &'a Session,
210+
definitions: &Definitions,
211+
) -> Option<OnDiskCache<'a>> {
209212
if sess.opts.incremental.is_none() {
210213
return None;
211214
}
@@ -217,7 +220,9 @@ pub fn load_query_result_cache<'a>(sess: &'a Session, definitions: &Definitions)
217220
&query_cache_path(sess),
218221
sess.is_nightly_build(),
219222
) {
220-
LoadResult::Ok { data: (bytes, start_pos) } => Some(OnDiskCache::new(sess, bytes, start_pos, definitions)),
223+
LoadResult::Ok { data: (bytes, start_pos) } => {
224+
Some(OnDiskCache::new(sess, bytes, start_pos, definitions))
225+
}
221226
_ => Some(OnDiskCache::new_empty(sess.source_map())),
222227
}
223228
}

compiler/rustc_middle/src/dep_graph/dep_node.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ macro_rules! define_dep_nodes {
252252
/// has been removed.
253253
fn extract_def_id(&self, tcx: TyCtxt<'tcx>) -> Option<DefId> {
254254
if self.kind.can_reconstruct_query_key() {
255-
let def_path_hash = DefPathHash(self.hash);
256-
tcx.queries.on_disk_cache.as_ref()?.def_path_hash_to_def_id(tcx, def_path_hash)
255+
tcx.queries.on_disk_cache.as_ref()?.def_path_hash_to_def_id(tcx, DefPathHash(self.hash.into()))
257256
} else {
258257
None
259258
}
@@ -326,7 +325,9 @@ impl<'tcx> DepNodeParams<TyCtxt<'tcx>> for DefId {
326325
// we will use the old DefIndex as an initial guess for
327326
// a lookup into the crate metadata.
328327
if !self.is_local() {
329-
tcx.queries.on_disk_cache.store_foreign_def_id_hash(*self, hash);
328+
if let Some(cache) = &tcx.queries.on_disk_cache {
329+
cache.store_foreign_def_id_hash(*self, hash);
330+
}
330331
}
331332
hash.0
332333
}

compiler/rustc_middle/src/dep_graph/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
9292
type StableHashingContext = StableHashingContext<'tcx>;
9393

9494
fn register_reused_dep_path_hash(&self, hash: DefPathHash) {
95-
self.queries.on_disk_cache.register_reused_dep_path_hash(hash)
95+
if let Some(cache) = self.queries.on_disk_cache.as_ref() {
96+
cache.register_reused_dep_path_hash(hash)
97+
}
9698
}
9799

98100
fn create_stable_hashing_context(&self) -> Self::StableHashingContext {

compiler/rustc_middle/src/ty/query/on_disk_cache.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,13 @@ impl<'a, 'tcx> Decodable<CacheDecoder<'a, 'tcx>> for DefId {
862862
// If we get to this point, then all of the query inputs were green,
863863
// which means that the definition with this hash is guaranteed to
864864
// still exist in the current compilation session.
865-
Ok(d.tcx().queries.on_disk_cache.def_path_hash_to_def_id(d.tcx(), def_path_hash).unwrap())
865+
Ok(d.tcx()
866+
.queries
867+
.on_disk_cache
868+
.as_ref()
869+
.unwrap()
870+
.def_path_hash_to_def_id(d.tcx(), def_path_hash)
871+
.unwrap())
866872
}
867873
}
868874

compiler/rustc_query_system/src/dep_graph/graph.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ impl<K: DepKind> DepGraph<K> {
709709
// from the old incremental cache into the new cache that we serialize
710710
// and the end of this compilation session.
711711
if dep_node.kind.can_reconstruct_query_key() {
712-
tcx.register_reused_dep_path_hash(DefPathHash(dep_node.hash));
712+
tcx.register_reused_dep_path_hash(DefPathHash(dep_node.hash.into()));
713713
}
714714

715715
// ... emitting any stored diagnostic ...

0 commit comments

Comments
 (0)