Skip to content

Commit 360ef49

Browse files
committed
supply a real "caller" span to drop calls
1 parent c303ac0 commit 360ef49

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Diff for: src/interpreter/terminator/intrinsics.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,15 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
190190
};
191191
let mut drops = Vec::new();
192192
self.drop(lvalue, ty, &mut drops)?;
193+
let span = {
194+
let frame = self.frame();
195+
frame.mir[frame.block].terminator().source_info.span
196+
};
193197
// need to change the block before pushing the drop impl stack frames
194198
// we could do this for all intrinsics before evaluating the intrinsics, but if
195199
// the evaluation fails, we should not have moved forward
196200
self.goto_block(target);
197-
return self.eval_drop_impls(drops);
201+
return self.eval_drop_impls(drops, span);
198202
}
199203

200204
"fabsf32" => {

Diff for: src/interpreter/terminator/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
118118
let mut drops = Vec::new();
119119
self.drop(lval, ty, &mut drops)?;
120120
self.goto_block(target);
121-
self.eval_drop_impls(drops)?;
121+
self.eval_drop_impls(drops, terminator.source_info.span)?;
122122
}
123123

124124
Assert { ref cond, expected, ref msg, target, .. } => {
@@ -151,12 +151,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
151151
Ok(())
152152
}
153153

154-
pub fn eval_drop_impls(&mut self, drops: Vec<(DefId, Value, &'tcx Substs<'tcx>)>) -> EvalResult<'tcx, ()> {
155-
let span = self.frame().span;
154+
pub fn eval_drop_impls(&mut self, drops: Vec<(DefId, Value, &'tcx Substs<'tcx>)>, span: Span) -> EvalResult<'tcx, ()> {
156155
// add them to the stack in reverse order, because the impl that needs to run the last
157156
// is the one that needs to be at the bottom of the stack
158157
for (drop_def_id, self_arg, substs) in drops.into_iter().rev() {
159-
// FIXME: supply a real span
160158
let mir = self.load_mir(drop_def_id)?;
161159
trace!("substs for drop glue: {:?}", substs);
162160
self.push_stack_frame(

0 commit comments

Comments
 (0)