diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs index f5cb36b5ba216..5ff12a17887df 100644 --- a/compiler/rustc_macros/src/query.rs +++ b/compiler/rustc_macros/src/query.rs @@ -372,7 +372,7 @@ fn add_query_description_impl( quote! { #[allow(unused_variables, unused_braces)] #[inline] - fn cache_on_disk(#tcx: QueryCtxt<'tcx>, #key: &Self::Key) -> bool { + fn cache_on_disk(#tcx: TyCtxt<'tcx>, #key: &Self::Key) -> bool { #expr } @@ -384,7 +384,7 @@ fn add_query_description_impl( } quote! { #[inline] - fn cache_on_disk(_: QueryCtxt<'tcx>, _: &Self::Key) -> bool { + fn cache_on_disk(_: TyCtxt<'tcx>, _: &Self::Key) -> bool { false } diff --git a/compiler/rustc_query_impl/src/on_disk_cache.rs b/compiler/rustc_query_impl/src/on_disk_cache.rs index 90c06c7b231ab..552906aac31a7 100644 --- a/compiler/rustc_query_impl/src/on_disk_cache.rs +++ b/compiler/rustc_query_impl/src/on_disk_cache.rs @@ -1033,7 +1033,7 @@ where if res.is_err() { return; } - if Q::cache_on_disk(tcx, &key) { + if Q::cache_on_disk(*tcx.dep_context(), &key) { let dep_node = SerializedDepNodeIndex::new(dep_node.index()); // Record position of the cache entry. diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index 8401104e7c6d7..6282a9dcd52d7 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -315,7 +315,7 @@ macro_rules! define_queries { } else { tcx.queries.extern_providers.$name }; - let cache_on_disk = Self::cache_on_disk(tcx, key); + let cache_on_disk = Self::cache_on_disk(tcx.tcx, key); QueryVtable { anon: is_anon!([$($modifiers)*]), eval_always: is_eval_always!([$($modifiers)*]), @@ -415,7 +415,6 @@ macro_rules! define_queries { debug_assert!(tcx.dep_graph.is_green(&dep_node)); let key = recover(tcx, dep_node).unwrap_or_else(|| panic!("Failed to recover key for {:?} with hash {}", dep_node, dep_node.hash)); - let tcx = QueryCtxt::from_tcx(tcx); if queries::$name::cache_on_disk(tcx, &key) { let _ = tcx.$name(key); } diff --git a/compiler/rustc_query_system/src/query/config.rs b/compiler/rustc_query_system/src/query/config.rs index 6c4e6196c9d6d..d2b102b6f8968 100644 --- a/compiler/rustc_query_system/src/query/config.rs +++ b/compiler/rustc_query_system/src/query/config.rs @@ -71,5 +71,5 @@ pub trait QueryDescription: QueryConfig { // Don't use this method to compute query results, instead use the methods on TyCtxt fn make_vtable(tcx: CTX, key: &Self::Key) -> QueryVtable; - fn cache_on_disk(tcx: CTX, key: &Self::Key) -> bool; + fn cache_on_disk(tcx: CTX::DepContext, key: &Self::Key) -> bool; }