@@ -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
@@ -952,6 +949,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
952949 // implementation fail -- a problem shared by rustc.
953950 let place = self . force_allocation ( place) ?;
954951
952+ // We behave a bit different from codegen here.
953+ // Codegen creates an `InstanceDef::Virtual` with index 0 (the slot of the drop method) and
954+ // then dispatches that to the normal call machinery. However, our call machinery currently
955+ // only supports calling `VtblEntry::Method`; it would choke on a `MetadataDropInPlace`. So
956+ // instead we do the virtual call stuff ourselves. It's easier here than in `eval_fn_call`
957+ // since we can just get a place of the underlying type and use `mplace_to_ref`.
955958 let place = match place. layout . ty . kind ( ) {
956959 ty:: Dynamic ( data, _, ty:: Dyn ) => {
957960 // Dropping a trait object. Need to find actual drop fn.
0 commit comments