diff --git a/src/interpreter/terminator/intrinsics.rs b/src/interpreter/terminator/intrinsics.rs index 1781211c9c70..9c7b13adf76b 100644 --- a/src/interpreter/terminator/intrinsics.rs +++ b/src/interpreter/terminator/intrinsics.rs @@ -190,11 +190,15 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { }; let mut drops = Vec::new(); self.drop(lvalue, ty, &mut drops)?; + let span = { + let frame = self.frame(); + frame.mir[frame.block].terminator().source_info.span + }; // need to change the block before pushing the drop impl stack frames // we could do this for all intrinsics before evaluating the intrinsics, but if // the evaluation fails, we should not have moved forward self.goto_block(target); - return self.eval_drop_impls(drops); + return self.eval_drop_impls(drops, span); } "fabsf32" => { diff --git a/src/interpreter/terminator/mod.rs b/src/interpreter/terminator/mod.rs index e95d68a67db1..0b80b633829c 100644 --- a/src/interpreter/terminator/mod.rs +++ b/src/interpreter/terminator/mod.rs @@ -118,7 +118,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { let mut drops = Vec::new(); self.drop(lval, ty, &mut drops)?; self.goto_block(target); - self.eval_drop_impls(drops)?; + self.eval_drop_impls(drops, terminator.source_info.span)?; } Assert { ref cond, expected, ref msg, target, .. } => { @@ -151,12 +151,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { Ok(()) } - pub fn eval_drop_impls(&mut self, drops: Vec<(DefId, Value, &'tcx Substs<'tcx>)>) -> EvalResult<'tcx, ()> { - let span = self.frame().span; + pub fn eval_drop_impls(&mut self, drops: Vec<(DefId, Value, &'tcx Substs<'tcx>)>, span: Span) -> EvalResult<'tcx, ()> { // add them to the stack in reverse order, because the impl that needs to run the last // is the one that needs to be at the bottom of the stack for (drop_def_id, self_arg, substs) in drops.into_iter().rev() { - // FIXME: supply a real span let mir = self.load_mir(drop_def_id)?; trace!("substs for drop glue: {:?}", substs); self.push_stack_frame(