@@ -163,18 +163,14 @@ where
163163 } ) ;
164164 }
165165 DropStyle :: Static => {
166- let loc = self . terminator_loc ( bb) ;
167- self . elaborator . clear_drop_flag ( loc, self . path , DropFlagMode :: Deep ) ;
168166 self . elaborator . patch ( ) . patch_terminator ( bb, TerminatorKind :: Drop {
169167 location : self . place . clone ( ) ,
170168 target : self . succ ,
171169 unwind : self . unwind . into_option ( ) ,
172170 } ) ;
173171 }
174172 DropStyle :: Conditional => {
175- let unwind = self . unwind ; // FIXME(#43234)
176- let succ = self . succ ;
177- let drop_bb = self . complete_drop ( Some ( DropFlagMode :: Deep ) , succ, unwind) ;
173+ let drop_bb = self . complete_drop ( self . succ , self . unwind ) ;
178174 self . elaborator . patch ( ) . patch_terminator ( bb, TerminatorKind :: Goto {
179175 target : drop_bb
180176 } ) ;
@@ -236,7 +232,7 @@ where
236232 // Using `self.path` here to condition the drop on
237233 // our own drop flag.
238234 path : self . path
239- } . complete_drop ( None , succ, unwind)
235+ } . complete_drop ( succ, unwind)
240236 }
241237 }
242238
@@ -265,13 +261,7 @@ where
265261 // Clear the "master" drop flag at the end. This is needed
266262 // because the "master" drop protects the ADT's discriminant,
267263 // which is invalidated after the ADT is dropped.
268- let ( succ, unwind) = ( self . succ , self . unwind ) ; // FIXME(#43234)
269- (
270- self . drop_flag_reset_block ( DropFlagMode :: Shallow , succ, unwind) ,
271- unwind. map ( |unwind| {
272- self . drop_flag_reset_block ( DropFlagMode :: Shallow , unwind, Unwind :: InCleanup )
273- } )
274- )
264+ ( self . drop_flag_reset_block ( DropFlagMode :: Shallow , self . succ , self . unwind ) , self . unwind )
275265 }
276266
277267 /// Creates a full drop ladder, consisting of 2 connected half-drop-ladders
@@ -827,9 +817,7 @@ where
827817 }
828818 }
829819 ty:: Dynamic ( ..) => {
830- let unwind = self . unwind ; // FIXME(#43234)
831- let succ = self . succ ;
832- self . complete_drop ( Some ( DropFlagMode :: Deep ) , succ, unwind)
820+ self . complete_drop ( self . succ , self . unwind )
833821 }
834822 ty:: Array ( ety, size) => {
835823 let size = size. try_eval_usize ( self . tcx ( ) , self . elaborator . param_env ( ) ) ;
@@ -850,18 +838,12 @@ where
850838 /// drop(self.place)
851839 fn complete_drop (
852840 & mut self ,
853- drop_mode : Option < DropFlagMode > ,
854841 succ : BasicBlock ,
855842 unwind : Unwind ,
856843 ) -> BasicBlock {
857- debug ! ( "complete_drop({:?},{:?})" , self , drop_mode ) ;
844+ debug ! ( "complete_drop(succ= {:?}, unwind= {:?})" , succ , unwind ) ;
858845
859846 let drop_block = self . drop_block ( succ, unwind) ;
860- let drop_block = if let Some ( mode) = drop_mode {
861- self . drop_flag_reset_block ( mode, drop_block, unwind)
862- } else {
863- drop_block
864- } ;
865847
866848 self . drop_flag_test_block ( drop_block, succ, unwind)
867849 }
@@ -873,6 +855,11 @@ where
873855 {
874856 debug ! ( "drop_flag_reset_block({:?},{:?})" , self , mode) ;
875857
858+ if unwind. is_cleanup ( ) {
859+ // The drop flag isn't read again on the unwind path, so don't
860+ // bother setting it.
861+ return succ;
862+ }
876863 let block = self . new_block ( unwind, TerminatorKind :: Goto { target : succ } ) ;
877864 let block_start = Location { block : block, statement_index : 0 } ;
878865 self . elaborator . clear_drop_flag ( block_start, self . path , mode) ;
@@ -976,11 +963,6 @@ where
976963 self . elaborator . patch ( ) . new_temp ( ty, self . source_info . span )
977964 }
978965
979- fn terminator_loc ( & mut self , bb : BasicBlock ) -> Location {
980- let body = self . elaborator . body ( ) ;
981- self . elaborator . patch ( ) . terminator_loc ( body, bb)
982- }
983-
984966 fn constant_usize ( & self , val : u16 ) -> Operand < ' tcx > {
985967 Operand :: Constant ( box Constant {
986968 span : self . source_info . span ,
0 commit comments