Skip to content

Commit 1b8979c

Browse files
committed
Add an optional message to abort
1 parent 9082cc4 commit 1b8979c

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ pub fn report_diagnostic<'tcx, 'mir>(
2020
let info = info.downcast_ref::<TerminationInfo>().expect("invalid MachineStop payload");
2121
match info {
2222
TerminationInfo::Exit(code) => return Some(*code),
23-
TerminationInfo::Abort => format!("the evaluated program aborted execution"),
23+
TerminationInfo::Abort(None) => format!("the evaluated program aborted execution"),
24+
TerminationInfo::Abort(Some(msg)) => format!("the evaluated program aborted execution: {}", msg),
2425
}
2526
}
2627
err_unsup!(NoMirFor(..)) => format!(

src/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Default for MiriConfig {
5353
/// Details of premature program termination.
5454
pub enum TerminationInfo {
5555
Exit(i64),
56-
Abort,
56+
Abort(Option<String>),
5757
}
5858

5959
/// Returns a freshly created `InterpCx`, along with an `MPlaceTy` representing

src/machine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
273273

274274
#[inline(always)]
275275
fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx, !> {
276-
throw_machine_stop!(TerminationInfo::Abort)
276+
throw_machine_stop!(TerminationInfo::Abort(None))
277277
}
278278

279279
#[inline(always)]

0 commit comments

Comments
 (0)