]> git.lizzy.rs Git - rust.git/commitdiff
Miri terminator handling: only do progress sanity check for 'Call' terminator
authorRalf Jung <post@ralfj.de>
Sat, 4 Apr 2020 13:53:47 +0000 (15:53 +0200)
committerRalf Jung <post@ralfj.de>
Sun, 5 Apr 2020 17:23:35 +0000 (19:23 +0200)
src/librustc_mir/interpret/step.rs
src/librustc_mir/interpret/terminator.rs

index 407849c2ce27c3580ddd1e159f782ea66154b0ba..2dd732e41eec2b1e7be03b86f11bf1e35c6c1ce2 100644 (file)
@@ -279,13 +279,8 @@ fn terminator(&mut self, terminator: &mir::Terminator<'tcx>) -> InterpResult<'tc
         self.tcx.span = terminator.source_info.span;
         self.memory.tcx.span = terminator.source_info.span;
 
-        let old_stack = self.cur_frame();
-        let old_bb = self.frame().block;
-
         self.eval_terminator(terminator)?;
         if !self.stack.is_empty() {
-            // This should change *something*
-            assert!(self.cur_frame() != old_stack || self.frame().block != old_bb);
             if let Some(block) = self.frame().block {
                 info!("// executing {:?}", block);
             }
index 6ebe5b80370cac86eb40c3ef4dbf64dac7492950..161fbdc9ed45a9210b38c9f36bb26cd8b7f81f86 100644 (file)
@@ -52,6 +52,8 @@ pub(super) fn eval_terminator(
             }
 
             Call { ref func, ref args, destination, ref cleanup, .. } => {
+                let old_stack = self.cur_frame();
+                let old_bb = self.frame().block;
                 let func = self.eval_operand(func, None)?;
                 let (fn_val, abi) = match func.layout.ty.kind {
                     ty::FnPtr(sig) => {
@@ -72,6 +74,9 @@ pub(super) fn eval_terminator(
                     None => None,
                 };
                 self.eval_fn_call(fn_val, abi, &args[..], ret, *cleanup)?;
+                // Sanity-check that `eval_fn_call` either pushed a new frame or
+                // did a jump to another block.
+                assert!(self.cur_frame() != old_stack || self.frame().block != old_bb);
             }
 
             Drop { location, target, unwind } => {