Skip to content

Commit 817f415

Browse files
committed
Use the machine stop error instead of abusing other error kinds
1 parent 7cd0d7f commit 817f415

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/eval.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub struct MiriConfig {
3333
/// Details of premature program termination.
3434
pub enum TerminationInfo {
3535
Exit(i64),
36+
PoppedTrackedPointerTag(Item),
3637
Abort,
3738
}
3839

@@ -218,6 +219,8 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) ->
218219
.expect("invalid MachineStop payload");
219220
match info {
220221
TerminationInfo::Exit(code) => return Some(*code),
222+
TerminationInfo::PoppedTrackedPointerTag(item) =>
223+
format!("popped tracked tag for item {:?}", item),
221224
TerminationInfo::Abort =>
222225
format!("the evaluated program aborted execution")
223226
}

src/stacked_borrows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc::hir::Mutability::{Mutable, Immutable};
1212
use rustc::mir::RetagKind;
1313

1414
use crate::{
15-
InterpResult, HelpersEvalContextExt,
15+
InterpResult, HelpersEvalContextExt, TerminationInfo,
1616
MemoryKind, MiriMemoryKind, RangeMap, AllocId, Pointer, Immediate, ImmTy, PlaceTy, MPlaceTy,
1717
};
1818

@@ -273,7 +273,7 @@ impl<'tcx> Stack {
273273
fn check_protector(item: &Item, tag: Option<Tag>, global: &GlobalState) -> InterpResult<'tcx> {
274274
if let Tag::Tagged(id) = item.tag {
275275
if Some(id) == global.tracked_pointer_tag {
276-
throw_unsup!(Unsupported(format!("disabling item {:?} for tag {:?}", item, tag)));
276+
throw_machine_stop!(TerminationInfo::PoppedTrackedPointerTag(item.clone()));
277277
}
278278
}
279279
if let Some(call) = item.protector {

0 commit comments

Comments
 (0)