Auto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrum
Cache `eval_to_allocation_raw` on disk https://github.com/rust-lang/rust/pull/74949#issuecomment-695833161 regressed the performance on these queries, this PR gets the perf back.
This commit is contained in:
commit
87d262acb5
@ -13,7 +13,7 @@
|
||||
use super::{sign_extend, truncate, AllocId, Allocation, InterpResult, Pointer, PointerArithmetic};
|
||||
|
||||
/// Represents the result of const evaluation via the `eval_to_allocation` query.
|
||||
#[derive(Clone, HashStable)]
|
||||
#[derive(Clone, HashStable, TyEncodable, TyDecodable)]
|
||||
pub struct ConstAlloc<'tcx> {
|
||||
// the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory`
|
||||
// (so you can use `AllocMap::unwrap_memory`).
|
||||
|
@ -716,6 +716,7 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
|
||||
"const-evaluating + checking `{}`",
|
||||
key.value.display(tcx)
|
||||
}
|
||||
cache_on_disk_if { true }
|
||||
}
|
||||
|
||||
/// Evaluates const items or anonymous constants
|
||||
@ -730,10 +731,7 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
|
||||
"simplifying constant for the type system `{}`",
|
||||
key.value.display(tcx)
|
||||
}
|
||||
cache_on_disk_if(_, opt_result) {
|
||||
// Only store results without errors
|
||||
opt_result.map_or(true, |r| r.is_ok())
|
||||
}
|
||||
cache_on_disk_if { true }
|
||||
}
|
||||
|
||||
/// Destructure a constant ADT or array into its variant index and its
|
||||
|
Loading…
Reference in New Issue
Block a user