Skip to content

Commit 86a933a

Browse files
committed
interpret: Drop: always evaluate place
1 parent d7ea278 commit 86a933a

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

compiler/rustc_const_eval/src/interpret/terminator.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
169169
}
170170

171171
Drop { place, target, unwind, replace: _ } => {
172-
let frame = self.frame();
173-
let ty = place.ty(&frame.body.local_decls, *self.tcx).ty;
174-
let ty = self.instantiate_from_frame_and_normalize_erasing_regions(frame, ty)?;
175-
let instance = Instance::resolve_drop_in_place(*self.tcx, ty);
172+
let place = self.eval_place(place)?;
173+
let instance = Instance::resolve_drop_in_place(*self.tcx, place.layout.ty);
176174
if let ty::InstanceDef::DropGlue(_, None) = instance.def {
177175
// This is the branch we enter if and only if the dropped type has no drop glue
178176
// whatsoever. This can happen as a result of monomorphizing a drop of a
@@ -181,8 +179,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
181179
self.go_to_block(target);
182180
return Ok(());
183181
}
184-
let place = self.eval_place(place)?;
185-
trace!("TerminatorKind::drop: {:?}, type {}", place, ty);
182+
trace!("TerminatorKind::drop: {:?}, type {}", place, place.layout.ty);
186183
self.drop_in_place(&place, instance, target, unwind)?;
187184
}
188185

0 commit comments

Comments
 (0)