From 817f4159a2146b95fd29fb5ea1725463e8f2dfd3 Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Mon, 9 Dec 2019 14:29:28 +0100 Subject: [PATCH] Use the machine stop error instead of abusing other error kinds --- src/eval.rs | 3 +++ src/stacked_borrows.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/eval.rs b/src/eval.rs index 81de2fa882c..9a70663716d 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -33,6 +33,7 @@ pub struct MiriConfig { /// Details of premature program termination. pub enum TerminationInfo { Exit(i64), + PoppedTrackedPointerTag(Item), Abort, } @@ -218,6 +219,8 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) -> .expect("invalid MachineStop payload"); match info { TerminationInfo::Exit(code) => return Some(*code), + TerminationInfo::PoppedTrackedPointerTag(item) => + format!("popped tracked tag for item {:?}", item), TerminationInfo::Abort => format!("the evaluated program aborted execution") } diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index ad70b05d8ab..8782eb83d18 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -12,7 +12,7 @@ use rustc::mir::RetagKind; use crate::{ - InterpResult, HelpersEvalContextExt, + InterpResult, HelpersEvalContextExt, TerminationInfo, MemoryKind, MiriMemoryKind, RangeMap, AllocId, Pointer, Immediate, ImmTy, PlaceTy, MPlaceTy, }; @@ -273,7 +273,7 @@ fn find_first_write_incompatible(&self, granting: usize) -> usize { fn check_protector(item: &Item, tag: Option, global: &GlobalState) -> InterpResult<'tcx> { if let Tag::Tagged(id) = item.tag { if Some(id) == global.tracked_pointer_tag { - throw_unsup!(Unsupported(format!("disabling item {:?} for tag {:?}", item, tag))); + throw_machine_stop!(TerminationInfo::PoppedTrackedPointerTag(item.clone())); } } if let Some(call) = item.protector { -- 2.44.0