Skip to content

Commit 7982d6a

Browse files
committed
interpret: make check_mplace public
1 parent 742d3f0 commit 7982d6a

File tree

1 file changed

+9
-9
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+9
-9
lines changed

compiler/rustc_const_eval/src/interpret/place.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,7 @@ where
316316
Ok(MPlaceTy { mplace, layout, align })
317317
}
318318

319-
/// Take an operand, representing a pointer, and dereference it to a place -- that
320-
/// will always be a MemPlace. Lives in `place.rs` because it creates a place.
319+
/// Take an operand, representing a pointer, and dereference it to a place.
321320
#[instrument(skip(self), level = "debug")]
322321
pub fn deref_operand(
323322
&self,
@@ -331,7 +330,7 @@ where
331330
}
332331

333332
let mplace = self.ref_to_mplace(&val)?;
334-
self.check_mplace_access(mplace, CheckInAllocMsg::DerefTest)?;
333+
self.check_mplace(mplace)?;
335334
Ok(mplace)
336335
}
337336

@@ -358,17 +357,18 @@ where
358357
}
359358

360359
/// Check if this mplace is dereferenceable and sufficiently aligned.
361-
fn check_mplace_access(
362-
&self,
363-
mplace: MPlaceTy<'tcx, M::Provenance>,
364-
msg: CheckInAllocMsg,
365-
) -> InterpResult<'tcx> {
360+
pub fn check_mplace(&self, mplace: MPlaceTy<'tcx, M::Provenance>) -> InterpResult<'tcx> {
366361
let (size, align) = self
367362
.size_and_align_of_mplace(&mplace)?
368363
.unwrap_or((mplace.layout.size, mplace.layout.align.abi));
369364
assert!(mplace.align <= align, "dynamic alignment less strict than static one?");
370365
let align = M::enforce_alignment(self).then_some(align);
371-
self.check_ptr_access_align(mplace.ptr, size, align.unwrap_or(Align::ONE), msg)?;
366+
self.check_ptr_access_align(
367+
mplace.ptr,
368+
size,
369+
align.unwrap_or(Align::ONE),
370+
CheckInAllocMsg::DerefTest,
371+
)?;
372372
Ok(())
373373
}
374374

0 commit comments

Comments
 (0)