Fix comments related to abort()
This commit is contained in:
parent
3282b549ac
commit
345f230df9
@ -333,6 +333,10 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
|
|||||||
Err(ConstEvalErrKind::AssertFailure(err).into())
|
Err(ConstEvalErrKind::AssertFailure(err).into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
|
||||||
|
Err(ConstEvalErrKind::Abort(msg).into())
|
||||||
|
}
|
||||||
|
|
||||||
fn ptr_to_int(_mem: &Memory<'mir, 'tcx, Self>, _ptr: Pointer) -> InterpResult<'tcx, u64> {
|
fn ptr_to_int(_mem: &Memory<'mir, 'tcx, Self>, _ptr: Pointer) -> InterpResult<'tcx, u64> {
|
||||||
Err(ConstEvalErrKind::NeedsRfc("pointer-to-integer cast".to_string()).into())
|
Err(ConstEvalErrKind::NeedsRfc("pointer-to-integer cast".to_string()).into())
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
None => match intrinsic_name {
|
None => match intrinsic_name {
|
||||||
sym::transmute => throw_ub_format!("transmuting to uninhabited type"),
|
sym::transmute => throw_ub_format!("transmuting to uninhabited type"),
|
||||||
sym::unreachable => throw_ub!(Unreachable),
|
sym::unreachable => throw_ub!(Unreachable),
|
||||||
sym::abort => M::abort(self, "aborted execution".to_owned())?,
|
sym::abort => M::abort(self, "the program aborted execution".to_owned())?,
|
||||||
// Unsupported diverging intrinsic.
|
// Unsupported diverging intrinsic.
|
||||||
_ => return Ok(false),
|
_ => return Ok(false),
|
||||||
},
|
},
|
||||||
|
@ -176,10 +176,8 @@ pub trait Machine<'mir, 'tcx>: Sized {
|
|||||||
) -> InterpResult<'tcx>;
|
) -> InterpResult<'tcx>;
|
||||||
|
|
||||||
/// Called to evaluate `Abort` MIR terminator.
|
/// Called to evaluate `Abort` MIR terminator.
|
||||||
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
|
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, _msg: String) -> InterpResult<'tcx, !> {
|
||||||
use crate::const_eval::ConstEvalErrKind;
|
throw_unsup_format!("aborting execution is not supported")
|
||||||
|
|
||||||
Err(ConstEvalErrKind::Abort(msg).into())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called for all binary operations where the LHS has pointer type.
|
/// Called for all binary operations where the LHS has pointer type.
|
||||||
|
@ -110,7 +110,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Abort => {
|
Abort => {
|
||||||
M::abort(self, "aborted execution".to_owned())?;
|
M::abort(self, "the program aborted execution".to_owned())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we encounter Resume, we've finished unwinding
|
// When we encounter Resume, we've finished unwinding
|
||||||
|
Loading…
x
Reference in New Issue
Block a user