Cache eval_to_allocation_raw on disk

This commit is contained in:
Oliver Scherer 2020-09-21 11:38:39 +02:00
parent 70148d7b31
commit c160bf3c3e
2 changed files with 5 additions and 1 deletions

View File

@ -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`).

View File

@ -716,6 +716,10 @@ fn describe_as_module(def_id: LocalDefId, tcx: TyCtxt<'_>) -> String {
"const-evaluating + checking `{}`",
key.value.display(tcx)
}
cache_on_disk_if(_, opt_result) {
// Only store results without errors
opt_result.map_or(true, |r| r.is_ok())
}
}
/// Evaluates const items or anonymous constants