Skip to content

Commit c160bf3

Browse files
committed
Cache eval_to_allocation_raw on disk
1 parent 70148d7 commit c160bf3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
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

+4
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,10 @@ rustc_queries! {
716716
"const-evaluating + checking `{}`",
717717
key.value.display(tcx)
718718
}
719+
cache_on_disk_if(_, opt_result) {
720+
// Only store results without errors
721+
opt_result.map_or(true, |r| r.is_ok())
722+
}
719723
}
720724

721725
/// Evaluates const items or anonymous constants

0 commit comments

Comments
 (0)