1
Fork 0

Address review comments

This commit is contained in:
Oliver Scherer 2020-09-07 17:30:38 +02:00
parent 90708c15c4
commit 182ed8544d
29 changed files with 184 additions and 179 deletions

View file

@ -1,4 +1,4 @@
use super::{AllocId, Pointer, RawConst, Scalar};
use super::{AllocId, ConstAlloc, Pointer, Scalar};
use crate::mir::interpret::ConstValue;
use crate::ty::{layout, query::TyCtxtAt, tls, FnSig, Ty};
@ -27,7 +27,7 @@ CloneTypeFoldableAndLiftImpls! {
ErrorHandled,
}
pub type EvalToAllocationRawResult<'tcx> = Result<RawConst<'tcx>, ErrorHandled>;
pub type EvalToAllocationRawResult<'tcx> = Result<ConstAlloc<'tcx>, ErrorHandled>;
pub type EvalToConstValueResult<'tcx> = Result<ConstValue<'tcx>, ErrorHandled>;
pub fn struct_error<'tcx>(tcx: TyCtxtAt<'tcx>, msg: &str) -> DiagnosticBuilder<'tcx> {

View file

@ -123,7 +123,7 @@ pub use self::error::{
ResourceExhaustionInfo, UndefinedBehaviorInfo, UninitBytesAccess, UnsupportedOpInfo,
};
pub use self::value::{get_slice_bytes, ConstValue, RawConst, Scalar, ScalarMaybeUninit};
pub use self::value::{get_slice_bytes, ConstAlloc, ConstValue, Scalar, ScalarMaybeUninit};
pub use self::allocation::{Allocation, AllocationExtra, InitMask, Relocations};

View file

@ -14,7 +14,7 @@ use super::{sign_extend, truncate, AllocId, Allocation, InterpResult, Pointer, P
/// Represents the result of const evaluation via the `eval_to_allocation` query.
#[derive(Clone, HashStable)]
pub struct RawConst<'tcx> {
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`).
pub alloc_id: AllocId,

View file

@ -713,7 +713,7 @@ rustc_queries! {
query eval_to_allocation_raw(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
-> EvalToAllocationRawResult<'tcx> {
desc { |tcx|
"const-evaluating `{}`",
"const-evaluating + checking `{}`",
key.value.display(tcx)
}
}
@ -727,7 +727,7 @@ rustc_queries! {
query eval_to_const_value(key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>)
-> EvalToConstValueResult<'tcx> {
desc { |tcx|
"const-evaluating + checking `{}`",
"simplifying constant for the type system `{}`",
key.value.display(tcx)
}
cache_on_disk_if(_, opt_result) {