Skip to content

Commit 0a9d7db

Browse files
committed
Remove unnecessary TRY_LOAD_FROM_DISK constant
1 parent 9273782 commit 0a9d7db

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

compiler/rustc_query_impl/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ pub use rustc_query_system::query::{deadlock, QueryContext};
3434
mod keys;
3535
use keys::Key;
3636

37-
use rustc_query_system::dep_graph::SerializedDepNodeIndex;
3837
pub use rustc_query_system::query::QueryConfig;
3938
pub(crate) use rustc_query_system::query::{QueryDescription, QueryVTable};
4039

compiler/rustc_query_impl/src/plumbing.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,6 @@ macro_rules! define_queries {
412412
impl<'tcx> QueryDescription<QueryCtxt<'tcx>> for queries::$name<'tcx> {
413413
rustc_query_description! { $name }
414414

415-
const TRY_LOAD_FROM_DISK: Option<fn(QueryCtxt<'tcx>, SerializedDepNodeIndex) -> Option<Self::Value>>
416-
= should_ever_cache_on_disk!([$($modifiers)*]);
417-
418415
type Cache = query_storage::$name<'tcx>;
419416

420417
#[inline(always)]
@@ -445,7 +442,7 @@ macro_rules! define_queries {
445442
hash_result: hash_result!([$($modifiers)*]),
446443
handle_cycle_error: handle_cycle_error!([$($modifiers)*]),
447444
compute,
448-
try_load_from_disk: if cache_on_disk { Self::TRY_LOAD_FROM_DISK } else { None },
445+
try_load_from_disk: if cache_on_disk { should_ever_cache_on_disk!([$($modifiers)*]) } else { None },
449446
}
450447
}
451448

compiler/rustc_query_system/src/query/config.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ pub struct QueryVTable<CTX: QueryContext, K, V> {
2929
pub compute: fn(CTX::DepContext, K) -> V,
3030
pub hash_result: Option<fn(&mut StableHashingContext<'_>, &V) -> Fingerprint>,
3131
pub handle_cycle_error: HandleCycleError,
32-
// NOTE: this is not quite the same as `Q::TRY_LOAD_FROM_DISK`; it can also be `None` if
33-
// `cache_on_disk` returned false for this key.
32+
// NOTE: this is also `None` if `cache_on_disk()` returns false, not just if it's unsupported by the query
3433
pub try_load_from_disk: Option<fn(CTX, SerializedDepNodeIndex) -> Option<V>>,
3534
}
3635

@@ -48,8 +47,6 @@ impl<CTX: QueryContext, K, V> QueryVTable<CTX, K, V> {
4847
}
4948

5049
pub trait QueryDescription<CTX: QueryContext>: QueryConfig {
51-
const TRY_LOAD_FROM_DISK: Option<fn(CTX, SerializedDepNodeIndex) -> Option<Self::Value>>;
52-
5350
type Cache: QueryCache<Key = Self::Key, Stored = Self::Stored, Value = Self::Value>;
5451

5552
fn describe(tcx: CTX, key: Self::Key) -> String;

0 commit comments

Comments
 (0)