@@ -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 ( ) ) ;
@@ -842,26 +830,18 @@ where
842830 }
843831
844832 /// Returns a basic block that drop a place using the context
845- /// and path in `c`. If `mode` is something, also clear `c`
846- /// according to it.
833+ /// and path in `c`.
847834 ///
848835 /// if FLAG(self.path)
849- /// if let Some(mode) = mode: FLAG(self.path)[mode] = false
850836 /// drop(self.place)
851837 fn complete_drop (
852838 & mut self ,
853- drop_mode : Option < DropFlagMode > ,
854839 succ : BasicBlock ,
855840 unwind : Unwind ,
856841 ) -> BasicBlock {
857- debug ! ( "complete_drop({:?},{:?})" , self , drop_mode ) ;
842+ debug ! ( "complete_drop(succ= {:?}, unwind= {:?})" , succ , unwind ) ;
858843
859844 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- } ;
865845
866846 self . drop_flag_test_block ( drop_block, succ, unwind)
867847 }
@@ -873,6 +853,11 @@ where
873853 {
874854 debug ! ( "drop_flag_reset_block({:?},{:?})" , self , mode) ;
875855
856+ if unwind. is_cleanup ( ) {
857+ // The drop flag isn't read again on the unwind path, so don't
858+ // bother setting it.
859+ return succ;
860+ }
876861 let block = self . new_block ( unwind, TerminatorKind :: Goto { target : succ } ) ;
877862 let block_start = Location { block : block, statement_index : 0 } ;
878863 self . elaborator . clear_drop_flag ( block_start, self . path , mode) ;
@@ -976,11 +961,6 @@ where
976961 self . elaborator . patch ( ) . new_temp ( ty, self . source_info . span )
977962 }
978963
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-
984964 fn constant_usize ( & self , val : u16 ) -> Operand < ' tcx > {
985965 Operand :: Constant ( box Constant {
986966 span : self . source_info . span ,
0 commit comments