Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 09974df

Browse files
authoredSep 5, 2023
Rollup merge of #115536 - RalfJung:interpreter-privacy, r=oli-obk
interpret: make MemPlace, Place, Operand types private to the interpreter Outside the interpreter, only the typed versions should be used.
2 parents a9336b6 + fa5f137 commit 09974df

File tree

41 files changed

+417
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+417
-338
lines changed
 

‎compiler/rustc_const_eval/src/const_eval/eval_queries.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn eval_body_using_ecx<'mir, 'tcx>(
7979
intern_const_alloc_recursive(ecx, intern_kind, &ret)?;
8080
// we leave alignment checks off, since this `ecx` will not be used for further evaluation anyway
8181

82-
debug!("eval_body_using_ecx done: {:?}", *ret);
82+
debug!("eval_body_using_ecx done: {:?}", ret);
8383
Ok(ret)
8484
}
8585

@@ -147,7 +147,7 @@ pub(super) fn op_to_const<'tcx>(
147147
// We know `offset` is relative to the allocation, so we can use `into_parts`.
148148
let to_const_value = |mplace: &MPlaceTy<'_>| {
149149
debug!("to_const_value(mplace: {:?})", mplace);
150-
match mplace.ptr.into_parts() {
150+
match mplace.ptr().into_parts() {
151151
(Some(alloc_id), offset) => {
152152
let alloc = ecx.tcx.global_alloc(alloc_id).unwrap_memory();
153153
ConstValue::ByRef { alloc, offset }
@@ -370,7 +370,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
370370
inner = true;
371371
}
372372
};
373-
let alloc_id = mplace.ptr.provenance.unwrap();
373+
let alloc_id = mplace.ptr().provenance.unwrap();
374374

375375
// Validation failed, report an error. This is always a hard error.
376376
if let Err(error) = validation {

‎compiler/rustc_const_eval/src/const_eval/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub(crate) fn const_caller_location(
3030
if intern_const_alloc_recursive(&mut ecx, InternKind::Constant, &loc_place).is_err() {
3131
bug!("intern_const_alloc_recursive should not error in this case")
3232
}
33-
ConstValue::Scalar(Scalar::from_maybe_pointer(loc_place.ptr, &tcx))
33+
ConstValue::Scalar(Scalar::from_maybe_pointer(loc_place.ptr(), &tcx))
3434
}
3535

3636
// We forbid type-level constants that contain more than `VALTREE_MAX_NODES` nodes.

0 commit comments

Comments
 (0)
Please sign in to comment.