diff --git a/src/eval.rs b/src/eval.rs index b09fb5918c..65f6d5dd02 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -213,7 +213,7 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) { }; e.print_backtrace(); if let Some(frame) = ecx.stack().last() { - let block = &frame.body.basic_blocks()[frame.block]; + let block = &frame.body.basic_blocks()[frame.block.unwrap()]; let span = if frame.stmt < block.statements.len() { block.statements[frame.stmt].source_info.span } else { diff --git a/src/machine.rs b/src/machine.rs index c76cc2e568..20abfdcf54 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -173,6 +173,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> { args: &[OpTy<'tcx, Tag>], dest: Option>, ret: Option, + _unwind: Option, ) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> { ecx.find_fn(instance, args, dest, ret) } @@ -194,8 +195,14 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> { span: Span, instance: ty::Instance<'tcx>, args: &[OpTy<'tcx, Tag>], - dest: PlaceTy<'tcx, Tag>, + dest: Option>, + _ret: Option, + _unwind: Option ) -> InterpResult<'tcx> { + let dest = match dest { + Some(dest) => dest, + None => throw_ub!(Unreachable) + }; ecx.call_intrinsic(span, instance, args, dest) } @@ -353,13 +360,15 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> { fn stack_pop( ecx: &mut InterpCx<'mir, 'tcx, Self>, extra: stacked_borrows::CallId, - ) -> InterpResult<'tcx> { - Ok(ecx + _unwinding: bool + ) -> InterpResult<'tcx, StackPopInfo> { + ecx .memory .extra .stacked_borrows .borrow_mut() - .end_call(extra)) + .end_call(extra); + Ok(StackPopInfo::Normal) } #[inline(always)] diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 1f43a83576..55ec36387f 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -335,7 +335,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx mir, Some(ret_place), // Directly return to caller. - StackPopCleanup::Goto(Some(ret)), + StackPopCleanup::Goto { ret: Some(ret), unwind: None }, )?; let mut args = this.frame().body.args_iter(); diff --git a/src/shims/intrinsics.rs b/src/shims/intrinsics.rs index 7470090f52..2e41ab1ca6 100644 --- a/src/shims/intrinsics.rs +++ b/src/shims/intrinsics.rs @@ -22,7 +22,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx dest: PlaceTy<'tcx, Tag>, ) -> InterpResult<'tcx> { let this = self.eval_context_mut(); - if this.emulate_intrinsic(span, instance, args, dest)? { + if this.emulate_intrinsic(span, instance, args, Some(dest))? { return Ok(()); } let tcx = &{this.tcx.tcx}; diff --git a/src/shims/mod.rs b/src/shims/mod.rs index 3302143f48..d9de27596c 100644 --- a/src/shims/mod.rs +++ b/src/shims/mod.rs @@ -27,7 +27,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ); // First, run the common hooks also supported by CTFE. - if this.hook_fn(instance, args, dest)? { + if this.hook_panic_fn(instance, args, dest)? { this.goto_block(ret)?; return Ok(None); }