1
Fork 0

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 crate::ty::{ParamEnv, Ty, TyCtxt};
use super::{sign_extend, truncate, AllocId, Allocation, InterpResult, Pointer, PointerArithmetic}; use super::{sign_extend, truncate, AllocId, Allocation, InterpResult, Pointer, PointerArithmetic};
/// Represents the result of const evaluation via the `eval_to_allocation` query. /// Represents the result of const evaluation via the `eval_to_allocation` query.
#[derive(Clone, HashStable)] #[derive(Clone, HashStable, TyEncodable, TyDecodable)]
pub struct ConstAlloc<'tcx> { pub struct ConstAlloc<'tcx> {
// the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory` // the value lives here, at offset 0, and that allocation definitely is a `AllocKind::Memory`
// (so you can use `AllocMap::unwrap_memory`). // (so you can use `AllocMap::unwrap_memory`).

View file

@ -716,6 +716,10 @@ rustc_queries! {
"const-evaluating + checking `{}`", "const-evaluating + checking `{}`",
key.value.display(tcx) 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 /// Evaluates const items or anonymous constants