diff --git a/compiler/rustc_query_impl/src/dep_kind_vtables.rs b/compiler/rustc_query_impl/src/dep_kind_vtables.rs index 209a652e39b0..fa82a0413b1a 100644 --- a/compiler/rustc_query_impl/src/dep_kind_vtables.rs +++ b/compiler/rustc_query_impl/src/dep_kind_vtables.rs @@ -104,6 +104,7 @@ pub(crate) fn Metadata<'tcx>() -> DepKindVTable<'tcx> { /// Called from macro-generated code for each query. pub(crate) fn make_dep_kind_vtable_for_query<'tcx, Q>( is_anon: bool, + is_cache_on_disk: bool, is_eval_always: bool, ) -> DepKindVTable<'tcx> where @@ -127,7 +128,8 @@ pub(crate) fn make_dep_kind_vtable_for_query<'tcx, Q>( is_eval_always, key_fingerprint_style, force_from_dep_node_fn: can_recover.then_some(force_from_dep_node_inner::), - promote_from_disk_fn: can_recover.then_some(promote_from_disk_inner::), + promote_from_disk_fn: (can_recover && is_cache_on_disk) + .then_some(promote_from_disk_inner::), } } diff --git a/compiler/rustc_query_impl/src/plumbing.rs b/compiler/rustc_query_impl/src/plumbing.rs index fde3de7fec52..0fed2e42db53 100644 --- a/compiler/rustc_query_impl/src/plumbing.rs +++ b/compiler/rustc_query_impl/src/plumbing.rs @@ -697,6 +697,7 @@ pub(crate) fn $name<'tcx>() -> DepKindVTable<'tcx> { use $crate::query_impl::$name::VTableGetter; make_dep_kind_vtable_for_query::( is_anon!([$($modifiers)*]), + if_cache_on_disk!([$($modifiers)*] true false), is_eval_always!([$($modifiers)*]), ) }