Skip to content

Commit 345f230

Browse files
committed
Fix comments related to abort()
1 parent 3282b54 commit 345f230

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

compiler/rustc_mir/src/const_eval/machine.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,10 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> for CompileTimeInterpreter<'mir,
333333
Err(ConstEvalErrKind::AssertFailure(err).into())
334334
}
335335

336+
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
337+
Err(ConstEvalErrKind::Abort(msg).into())
338+
}
339+
336340
fn ptr_to_int(_mem: &Memory<'mir, 'tcx, Self>, _ptr: Pointer) -> InterpResult<'tcx, u64> {
337341
Err(ConstEvalErrKind::NeedsRfc("pointer-to-integer cast".to_string()).into())
338342
}

compiler/rustc_mir/src/interpret/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
126126
None => match intrinsic_name {
127127
sym::transmute => throw_ub_format!("transmuting to uninhabited type"),
128128
sym::unreachable => throw_ub!(Unreachable),
129-
sym::abort => M::abort(self, "aborted execution".to_owned())?,
129+
sym::abort => M::abort(self, "the program aborted execution".to_owned())?,
130130
// Unsupported diverging intrinsic.
131131
_ => return Ok(false),
132132
},

compiler/rustc_mir/src/interpret/machine.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,8 @@ pub trait Machine<'mir, 'tcx>: Sized {
176176
) -> InterpResult<'tcx>;
177177

178178
/// Called to evaluate `Abort` MIR terminator.
179-
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, msg: String) -> InterpResult<'tcx, !> {
180-
use crate::const_eval::ConstEvalErrKind;
181-
182-
Err(ConstEvalErrKind::Abort(msg).into())
179+
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>, _msg: String) -> InterpResult<'tcx, !> {
180+
throw_unsup_format!("aborting execution is not supported")
183181
}
184182

185183
/// Called for all binary operations where the LHS has pointer type.

compiler/rustc_mir/src/interpret/terminator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
110110
}
111111

112112
Abort => {
113-
M::abort(self, "aborted execution".to_owned())?;
113+
M::abort(self, "the program aborted execution".to_owned())?;
114114
}
115115

116116
// When we encounter Resume, we've finished unwinding

0 commit comments

Comments
 (0)