Retire rustc_dep_node_try_load_from_on_disk_cache.
This commit is contained in:
parent
e853cc0b28
commit
57ba8edb9e
2 changed files with 23 additions and 27 deletions
|
@ -421,7 +421,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
|
||||||
let mut query_stream = quote! {};
|
let mut query_stream = quote! {};
|
||||||
let mut query_description_stream = quote! {};
|
let mut query_description_stream = quote! {};
|
||||||
let mut dep_node_def_stream = quote! {};
|
let mut dep_node_def_stream = quote! {};
|
||||||
let mut try_load_from_on_disk_cache_stream = quote! {};
|
|
||||||
let mut cached_queries = quote! {};
|
let mut cached_queries = quote! {};
|
||||||
|
|
||||||
for group in groups.0 {
|
for group in groups.0 {
|
||||||
|
@ -439,22 +438,6 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
|
||||||
cached_queries.extend(quote! {
|
cached_queries.extend(quote! {
|
||||||
#name,
|
#name,
|
||||||
});
|
});
|
||||||
|
|
||||||
try_load_from_on_disk_cache_stream.extend(quote! {
|
|
||||||
::rustc_middle::dep_graph::DepKind::#name => {
|
|
||||||
if <#arg as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
|
|
||||||
debug_assert!($tcx.dep_graph
|
|
||||||
.node_color($dep_node)
|
|
||||||
.map(|c| c.is_green())
|
|
||||||
.unwrap_or(false));
|
|
||||||
|
|
||||||
let key = <#arg as DepNodeParams<TyCtxt<'_>>>::recover($tcx, $dep_node).unwrap();
|
|
||||||
if queries::#name::cache_on_disk($tcx, &key, None) {
|
|
||||||
let _ = $tcx.#name(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut attributes = Vec::new();
|
let mut attributes = Vec::new();
|
||||||
|
@ -528,14 +511,5 @@ pub fn rustc_queries(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
#query_description_stream
|
#query_description_stream
|
||||||
|
|
||||||
macro_rules! rustc_dep_node_try_load_from_on_disk_cache {
|
|
||||||
($dep_node:expr, $tcx:expr) => {
|
|
||||||
match $dep_node.kind {
|
|
||||||
#try_load_from_on_disk_cache_stream
|
|
||||||
_ => (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,7 +210,29 @@ pub fn force_from_dep_node<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> bool
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) {
|
pub(crate) fn try_load_from_on_disk_cache<'tcx>(tcx: TyCtxt<'tcx>, dep_node: &DepNode) {
|
||||||
rustc_dep_node_try_load_from_on_disk_cache!(dep_node, tcx)
|
macro_rules! try_load_from_on_disk_cache {
|
||||||
|
($($name:ident,)*) => {
|
||||||
|
match dep_node.kind {
|
||||||
|
$(DepKind::$name => {
|
||||||
|
if <query_keys::$name<'tcx> as DepNodeParams<TyCtxt<'_>>>::can_reconstruct_query_key() {
|
||||||
|
debug_assert!(tcx.dep_graph
|
||||||
|
.node_color(dep_node)
|
||||||
|
.map(|c| c.is_green())
|
||||||
|
.unwrap_or(false));
|
||||||
|
|
||||||
|
let key = <query_keys::$name<'tcx> as DepNodeParams<TyCtxt<'_>>>::recover(tcx, dep_node).unwrap();
|
||||||
|
if queries::$name::cache_on_disk(tcx, &key, None) {
|
||||||
|
let _ = tcx.$name(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})*
|
||||||
|
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rustc_cached_queries!(try_load_from_on_disk_cache!);
|
||||||
}
|
}
|
||||||
|
|
||||||
mod sealed {
|
mod sealed {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue