supply a real "caller" span to drop calls

This commit is contained in:
Oliver Schneider 2016-12-06 16:16:22 +01:00
parent c303ac001d
commit 360ef490f4
No known key found for this signature in database
GPG Key ID: 56D6EEA0FC67AC46
2 changed files with 7 additions and 5 deletions

View File

@ -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" => {

View File

@ -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(