]> git.lizzy.rs Git - rust.git/commitdiff
miri: add machine hook for Abort terminator
authorRalf Jung <post@ralfj.de>
Mon, 9 Mar 2020 09:45:20 +0000 (10:45 +0100)
committerRalf Jung <post@ralfj.de>
Mon, 9 Mar 2020 10:06:55 +0000 (11:06 +0100)
src/librustc_mir/interpret/machine.rs
src/librustc_mir/interpret/terminator.rs

index 6615cc608fb54c4f3beebe4670e6b5b8b8654afb..64a34fc7dd9ec01efe4d4774b2a11425a311e10a 100644 (file)
@@ -170,6 +170,11 @@ fn assert_panic(
         unwind: Option<mir::BasicBlock>,
     ) -> InterpResult<'tcx>;
 
+    /// Called to evaluate `Abort` MIR terminator.
+    fn abort(_ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
+        throw_unsup_format!("aborting execution is not supported");
+    }
+
     /// Called for all binary operations where the LHS has pointer type.
     ///
     /// Returns a (value, overflowed) pair if the operation succeeded
index 85fd502c69c31a56d00405fb6100c18bea937644..95d5276565f178940b06ad77637eba7f9cb38554 100644 (file)
@@ -99,6 +99,10 @@ pub(super) fn eval_terminator(
                 }
             }
 
+            Abort => {
+                M::abort(self)?;
+            }
+
             // When we encounter Resume, we've finished unwinding
             // cleanup for the current stack frame. We pop it in order
             // to continue unwinding the next frame
@@ -118,8 +122,9 @@ pub(super) fn eval_terminator(
             | FalseEdges { .. }
             | FalseUnwind { .. }
             | Yield { .. }
-            | GeneratorDrop
-            | Abort => bug!("{:#?} should have been eliminated by MIR pass", terminator.kind),
+            | GeneratorDrop => {
+                bug!("{:#?} should have been eliminated by MIR pass", terminator.kind)
+            }
         }
 
         Ok(())