fn assert_panic(
ecx: &mut InterpCx<'mir, 'tcx, Self>,
span: Span,
- msg: &AssertMessage<'tcx>,
+ msg: &mir::AssertMessage<'tcx>,
unwind: Option<mir::BasicBlock>,
) -> InterpResult<'tcx> {
ecx.assert_panic(span, msg, unwind)
let pointee_size = i64::try_from(self.layout_of(pointee_ty)?.size.bytes()).unwrap();
let offset = offset
.checked_mul(pointee_size)
- .ok_or_else(|| err_panic!(Overflow(mir::BinOp::Mul)))?;
+ .ok_or_else(|| err_ub_format!("overflow during offset comutation for inbounds pointer arithmetic"))?;
// We do this first, to rule out overflows.
let offset_ptr = ptr.ptr_signed_offset(offset, self)?;
// What we need to check is that starting at `min(ptr, offset_ptr)`,
let items = this.read_scalar(args[0])?.to_machine_usize(this)?;
let len = this.read_scalar(args[1])?.to_machine_usize(this)?;
let size =
- items.checked_mul(len).ok_or_else(|| err_panic!(Overflow(mir::BinOp::Mul)))?;
+ items.checked_mul(len).ok_or_else(|| err_ub_format!("overflow during calloc size computation"))?;
let res = this.malloc(size, /*zero_init:*/ true, MiriMemoryKind::C);
this.write_scalar(res, dest)?;
}
fn assert_panic(
&mut self,
span: Span,
- msg: &AssertMessage<'tcx>,
+ msg: &mir::AssertMessage<'tcx>,
unwind: Option<mir::BasicBlock>,
) -> InterpResult<'tcx> {
- use rustc::mir::interpret::PanicInfo::*;
+ use rustc::mir::AssertKind::*;
let this = self.eval_context_mut();
match msg {