Skip to content

Commit

Permalink
Cache eval_to_allocation_raw on disk
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Sep 21, 2020
1 parent 70148d7 commit c160bf3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::ty::{ParamEnv, Ty, TyCtxt};
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`).
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ rustc_queries! {
"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
Expand Down

0 comments on commit c160bf3

Please sign in to comment.