@@ -408,19 +408,6 @@ where
408408 self . drop_ladder ( fields, succ, unwind) . 0
409409 }
410410
411- fn open_drop_for_box ( & mut self , adt : & ' tcx ty:: AdtDef , substs : SubstsRef < ' tcx > ) -> BasicBlock {
412- debug ! ( "open_drop_for_box({:?}, {:?}, {:?})" , self , adt, substs) ;
413-
414- let interior = self . tcx ( ) . mk_place_deref ( self . place ) ;
415- let interior_path = self . elaborator . deref_subpath ( self . path ) ;
416-
417- let succ = self . box_free_block ( adt, substs, self . succ , self . unwind ) ;
418- let unwind_succ =
419- self . unwind . map ( |unwind| self . box_free_block ( adt, substs, unwind, Unwind :: InCleanup ) ) ;
420-
421- self . drop_subpath ( interior, interior_path, succ, unwind_succ)
422- }
423-
424411 fn open_drop_for_adt ( & mut self , adt : & ' tcx ty:: AdtDef , substs : SubstsRef < ' tcx > ) -> BasicBlock {
425412 debug ! ( "open_drop_for_adt({:?}, {:?}, {:?})" , self , adt, substs) ;
426413 if adt. variants . is_empty ( ) {
@@ -872,11 +859,7 @@ where
872859 self . open_drop_for_tuple ( & tys)
873860 }
874861 ty:: Adt ( def, substs) => {
875- if def. is_box ( ) {
876- self . open_drop_for_box ( def, substs)
877- } else {
878- self . open_drop_for_adt ( def, substs)
879- }
862+ self . open_drop_for_adt ( def, substs)
880863 }
881864 ty:: Dynamic ( ..) => self . complete_drop ( self . succ , self . unwind ) ,
882865 ty:: Array ( ety, size) => {
@@ -925,59 +908,6 @@ where
925908 blk
926909 }
927910
928- /// Creates a block that frees the backing memory of a `Box` if its drop is required (either
929- /// statically or by checking its drop flag).
930- ///
931- /// The contained value will not be dropped.
932- fn box_free_block (
933- & mut self ,
934- adt : & ' tcx ty:: AdtDef ,
935- substs : SubstsRef < ' tcx > ,
936- target : BasicBlock ,
937- unwind : Unwind ,
938- ) -> BasicBlock {
939- let block = self . unelaborated_free_block ( adt, substs, target, unwind) ;
940- self . drop_flag_test_block ( block, target, unwind)
941- }
942-
943- /// Creates a block that frees the backing memory of a `Box` (without dropping the contained
944- /// value).
945- fn unelaborated_free_block (
946- & mut self ,
947- adt : & ' tcx ty:: AdtDef ,
948- substs : SubstsRef < ' tcx > ,
949- target : BasicBlock ,
950- unwind : Unwind ,
951- ) -> BasicBlock {
952- let tcx = self . tcx ( ) ;
953- let unit_temp = Place :: from ( self . new_temp ( tcx. mk_unit ( ) ) ) ;
954- let free_func = tcx. require_lang_item ( LangItem :: BoxFree , Some ( self . source_info . span ) ) ;
955- let args = adt. variants [ VariantIdx :: new ( 0 ) ]
956- . fields
957- . iter ( )
958- . enumerate ( )
959- . map ( |( i, f) | {
960- let field = Field :: new ( i) ;
961- let field_ty = f. ty ( tcx, substs) ;
962- Operand :: Move ( tcx. mk_place_field ( self . place , field, field_ty) )
963- } )
964- . collect ( ) ;
965-
966- let call = TerminatorKind :: Call {
967- func : Operand :: function_handle ( tcx, free_func, substs, self . source_info . span ) ,
968- args,
969- destination : Some ( ( unit_temp, target) ) ,
970- cleanup : None ,
971- from_hir_call : false ,
972- fn_span : self . source_info . span ,
973- } ; // FIXME(#43234)
974- let free_block = self . new_block ( unwind, call) ;
975-
976- let block_start = Location { block : free_block, statement_index : 0 } ;
977- self . elaborator . clear_drop_flag ( block_start, self . path , DropFlagMode :: Shallow ) ;
978- free_block
979- }
980-
981911 fn drop_block ( & mut self , target : BasicBlock , unwind : Unwind ) -> BasicBlock {
982912 let block =
983913 TerminatorKind :: Drop { place : self . place , target, unwind : unwind. into_option ( ) } ;
0 commit comments