]> git.lizzy.rs Git - rust.git/commitdiff
Use the machine stop error instead of abusing other error kinds
authorOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 9 Dec 2019 13:29:28 +0000 (14:29 +0100)
committerOliver Scherer <github35764891676564198441@oli-obk.de>
Mon, 9 Dec 2019 13:29:28 +0000 (14:29 +0100)
src/eval.rs
src/stacked_borrows.rs

index 81de2fa882c54883d9a0b56ff2ae4c6a6517cdcf..9a70663716d61ccff0829527e7e35de50ff34017 100644 (file)
@@ -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")
                     }
index ad70b05d8abd614266f0f6a0fba6b5975d031b71..8782eb83d1835c978a5a6fd357dae70c7cb6676b 100644 (file)
@@ -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<Tag>, 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 {