interpret: make MemPlace, Place, Operand types private to the interpreter
This commit is contained in:
parent
a989e25f1b
commit
fa5f13775a
41 changed files with 417 additions and 338 deletions
|
@ -79,7 +79,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
|
|||
intern_const_alloc_recursive(ecx, intern_kind, &ret)?;
|
||||
// we leave alignment checks off, since this `ecx` will not be used for further evaluation anyway
|
||||
|
||||
debug!("eval_body_using_ecx done: {:?}", *ret);
|
||||
debug!("eval_body_using_ecx done: {:?}", ret);
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ pub(super) fn op_to_const<'tcx>(
|
|||
// We know `offset` is relative to the allocation, so we can use `into_parts`.
|
||||
let to_const_value = |mplace: &MPlaceTy<'_>| {
|
||||
debug!("to_const_value(mplace: {:?})", mplace);
|
||||
match mplace.ptr.into_parts() {
|
||||
match mplace.ptr().into_parts() {
|
||||
(Some(alloc_id), offset) => {
|
||||
let alloc = ecx.tcx.global_alloc(alloc_id).unwrap_memory();
|
||||
ConstValue::ByRef { alloc, offset }
|
||||
|
@ -370,7 +370,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
|
|||
inner = true;
|
||||
}
|
||||
};
|
||||
let alloc_id = mplace.ptr.provenance.unwrap();
|
||||
let alloc_id = mplace.ptr().provenance.unwrap();
|
||||
|
||||
// Validation failed, report an error. This is always a hard error.
|
||||
if let Err(error) = validation {
|
||||
|
|
|
@ -30,7 +30,7 @@ pub(crate) fn const_caller_location(
|
|||
if intern_const_alloc_recursive(&mut ecx, InternKind::Constant, &loc_place).is_err() {
|
||||
bug!("intern_const_alloc_recursive should not error in this case")
|
||||
}
|
||||
ConstValue::Scalar(Scalar::from_maybe_pointer(loc_place.ptr, &tcx))
|
||||
ConstValue::Scalar(Scalar::from_maybe_pointer(loc_place.ptr(), &tcx))
|
||||
}
|
||||
|
||||
// We forbid type-level constants that contain more than `VALTREE_MAX_NODES` nodes.
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::const_eval::CanAccessStatics;
|
|||
use crate::interpret::MPlaceTy;
|
||||
use crate::interpret::{
|
||||
intern_const_alloc_recursive, ConstValue, ImmTy, Immediate, InternKind, MemPlaceMeta,
|
||||
MemoryKind, Place, Projectable, Scalar,
|
||||
MemoryKind, PlaceTy, Projectable, Scalar,
|
||||
};
|
||||
use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
|
||||
use rustc_middle::ty::{self, ScalarInt, Ty, TyCtxt};
|
||||
|
@ -318,7 +318,7 @@ fn valtree_into_mplace<'tcx>(
|
|||
let len_scalar = Scalar::from_target_usize(len as u64, &tcx);
|
||||
|
||||
Immediate::ScalarPair(
|
||||
Scalar::from_maybe_pointer((*pointee_place).ptr, &tcx),
|
||||
Scalar::from_maybe_pointer(pointee_place.ptr(), &tcx),
|
||||
len_scalar,
|
||||
)
|
||||
}
|
||||
|
@ -383,5 +383,5 @@ fn valtree_into_mplace<'tcx>(
|
|||
}
|
||||
|
||||
fn dump_place<'tcx>(ecx: &CompileTimeEvalContext<'tcx, 'tcx>, place: &MPlaceTy<'tcx>) {
|
||||
trace!("{:?}", ecx.dump_place(Place::Ptr(**place)));
|
||||
trace!("{:?}", ecx.dump_place(&PlaceTy::from(place.clone())));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue