Skip to content

Commit 87d262a

Browse files
committed
Auto merge of #77006 - oli-obk:🐌_const_queries, r=Mark-Simulacrum
Cache `eval_to_allocation_raw` on disk #74949 (comment) regressed the performance on these queries, this PR gets the perf back.
2 parents 893fadd + 40629ef commit 87d262a

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

compiler/rustc_middle/src/mir/interpret/value.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::ty::{ParamEnv, Ty, TyCtxt};
1313
use super::{sign_extend, truncate, AllocId, Allocation, InterpResult, Pointer, PointerArithmetic};
1414

1515
/// Represents the result of const evaluation via the `eval_to_allocation` query.
16-
#[derive(Clone, HashStable)]
16+
#[derive(Clone, HashStable, TyEncodable, TyDecodable)]
1717
pub struct ConstAlloc<'tcx> {
1818
// the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory`
1919
// (so you can use `AllocMap::unwrap_memory`).

compiler/rustc_middle/src/query/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,7 @@ rustc_queries! {
716716
"const-evaluating + checking `{}`",
717717
key.value.display(tcx)
718718
}
719+
cache_on_disk_if { true }
719720
}
720721

721722
/// Evaluates const items or anonymous constants
@@ -730,10 +731,7 @@ rustc_queries! {
730731
"simplifying constant for the type system `{}`",
731732
key.value.display(tcx)
732733
}
733-
cache_on_disk_if(_, opt_result) {
734-
// Only store results without errors
735-
opt_result.map_or(true, |r| r.is_ok())
736-
}
734+
cache_on_disk_if { true }
737735
}
738736

739737
/// Destructure a constant ADT or array into its variant index and its

0 commit comments

Comments
 (0)