Skip to content

Commit 138e96b

Browse files
committed
Do not require QueryCtxt for cache_on_disk.
1 parent 7c0920f commit 138e96b

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

compiler/rustc_macros/src/query.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ fn add_query_description_impl(
372372
quote! {
373373
#[allow(unused_variables, unused_braces)]
374374
#[inline]
375-
fn cache_on_disk(#tcx: QueryCtxt<'tcx>, #key: &Self::Key) -> bool {
375+
fn cache_on_disk(#tcx: TyCtxt<'tcx>, #key: &Self::Key) -> bool {
376376
#expr
377377
}
378378

@@ -384,7 +384,7 @@ fn add_query_description_impl(
384384
}
385385
quote! {
386386
#[inline]
387-
fn cache_on_disk(_: QueryCtxt<'tcx>, _: &Self::Key) -> bool {
387+
fn cache_on_disk(_: TyCtxt<'tcx>, _: &Self::Key) -> bool {
388388
false
389389
}
390390

compiler/rustc_query_impl/src/on_disk_cache.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ where
10331033
if res.is_err() {
10341034
return;
10351035
}
1036-
if Q::cache_on_disk(tcx, &key) {
1036+
if Q::cache_on_disk(*tcx.dep_context(), &key) {
10371037
let dep_node = SerializedDepNodeIndex::new(dep_node.index());
10381038

10391039
// Record position of the cache entry.

compiler/rustc_query_impl/src/plumbing.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ macro_rules! define_queries {
315315
} else {
316316
tcx.queries.extern_providers.$name
317317
};
318-
let cache_on_disk = Self::cache_on_disk(tcx, key);
318+
let cache_on_disk = Self::cache_on_disk(tcx.tcx, key);
319319
QueryVtable {
320320
anon: is_anon!([$($modifiers)*]),
321321
eval_always: is_eval_always!([$($modifiers)*]),
@@ -415,7 +415,6 @@ macro_rules! define_queries {
415415
debug_assert!(tcx.dep_graph.is_green(&dep_node));
416416

417417
let key = recover(tcx, dep_node).unwrap_or_else(|| panic!("Failed to recover key for {:?} with hash {}", dep_node, dep_node.hash));
418-
let tcx = QueryCtxt::from_tcx(tcx);
419418
if queries::$name::cache_on_disk(tcx, &key) {
420419
let _ = tcx.$name(key);
421420
}

compiler/rustc_query_system/src/query/config.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ pub trait QueryDescription<CTX: QueryContext>: QueryConfig {
7171
// Don't use this method to compute query results, instead use the methods on TyCtxt
7272
fn make_vtable(tcx: CTX, key: &Self::Key) -> QueryVtable<CTX, Self::Key, Self::Value>;
7373

74-
fn cache_on_disk(tcx: CTX, key: &Self::Key) -> bool;
74+
fn cache_on_disk(tcx: CTX::DepContext, key: &Self::Key) -> bool;
7575
}

0 commit comments

Comments
 (0)