Skip to content

Commit 57ba8ed

Browse files
committed
Retire rustc_dep_node_try_load_from_on_disk_cache.
1 parent e853cc0 commit 57ba8ed

File tree

2 files changed

+23
-27
lines changed

2 files changed

+23
-27
lines changed

compiler/rustc_macros/src/query.rs

-26
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
421421
let mut query_stream = quote! {};
422422
let mut query_description_stream = quote! {};
423423
let mut dep_node_def_stream = quote! {};
424-
let mut try_load_from_on_disk_cache_stream = quote! {};
425424
let mut cached_queries = quote! {};
426425

427426
for group in groups.0 {
@@ -439,22 +438,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
439438
cached_queries.extend(quote! {
440439
#name,
441440
});
442-
443-
try_load_from_on_disk_cache_stream.extend(quote! {
444-
::rustc_middle::dep_graph::DepKind::#name => {
445-
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
446-
debug_assert!($tcx.dep_graph
447-
.node_color($dep_node)
448-
.map(|c| c.is_green())
449-
.unwrap_or(false));
450-
451-
let key = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node).unwrap();
452-
if queries::#name::cache_on_disk($tcx, &key, None) {
453-
let _ = $tcx.#name(key);
454-
}
455-
}
456-
}
457-
});
458441
}
459442

460443
let mut attributes = Vec::new();
@@ -528,14 +511,5 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
528511
}
529512

530513
#query_description_stream
531-
532-
macro_rules! rustc_dep_node_try_load_from_on_disk_cache {
533-
($dep_node:expr, $tcx:expr) => {
534-
match $dep_node.kind {
535-
#try_load_from_on_disk_cache_stream
536-
_ => (),
537-
}
538-
}
539-
}
540514
})
541515
}

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

+23-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,29 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
210210
}
211211

212212
pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) {
213-
rustc_dep_node_try_load_from_on_disk_cache!(dep_node, tcx)
213+
macro_rules! try_load_from_on_disk_cache {
214+
($($name:ident,)*) => {
215+
match dep_node.kind {
216+
$(DepKind::$name => {
217+
if <query_keys::$name<'tcx> as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
218+
debug_assert!(tcx.dep_graph
219+
.node_color(dep_node)
220+
.map(|c| c.is_green())
221+
.unwrap_or(false));
222+
223+
let key = <query_keys::$name<'tcx> as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node).unwrap();
224+
if queries::$name::cache_on_disk(tcx, &key, None) {
225+
let _ = tcx.$name(key);
226+
}
227+
}
228+
})*
229+
230+
_ => (),
231+
}
232+
}
233+
}
234+
235+
rustc_cached_queries!(try_load_from_on_disk_cache!);
214236
}
215237

216238
mod sealed {

0 commit comments

Comments
 (0)