@@ -231,8 +231,6 @@ where
231
231
. patch_terminator ( bb, TerminatorKind :: Goto { target : self . succ } ) ;
232
232
}
233
233
DropStyle :: Static => {
234
- let loc = self . terminator_loc ( bb) ;
235
- self . elaborator . clear_drop_flag ( loc, self . path , DropFlagMode :: Deep ) ;
236
234
self . elaborator . patch ( ) . patch_terminator (
237
235
bb,
238
236
TerminatorKind :: Drop {
@@ -243,9 +241,7 @@ where
243
241
) ;
244
242
}
245
243
DropStyle :: Conditional => {
246
- let unwind = self . unwind ; // FIXME(#43234)
247
- let succ = self . succ ;
248
- let drop_bb = self . complete_drop ( Some ( DropFlagMode :: Deep ) , succ, unwind) ;
244
+ let drop_bb = self . complete_drop ( self . succ , self . unwind ) ;
249
245
self . elaborator
250
246
. patch ( )
251
247
. patch_terminator ( bb, TerminatorKind :: Goto { target : drop_bb } ) ;
@@ -317,7 +313,7 @@ where
317
313
// our own drop flag.
318
314
path : self . path ,
319
315
}
320
- . complete_drop ( None , succ, unwind)
316
+ . complete_drop ( succ, unwind)
321
317
}
322
318
}
323
319
@@ -346,13 +342,7 @@ where
346
342
// Clear the "master" drop flag at the end. This is needed
347
343
// because the "master" drop protects the ADT's discriminant,
348
344
// which is invalidated after the ADT is dropped.
349
- let ( succ, unwind) = ( self . succ , self . unwind ) ; // FIXME(#43234)
350
- (
351
- self . drop_flag_reset_block ( DropFlagMode :: Shallow , succ, unwind) ,
352
- unwind. map ( |unwind| {
353
- self . drop_flag_reset_block ( DropFlagMode :: Shallow , unwind, Unwind :: InCleanup )
354
- } ) ,
355
- )
345
+ ( self . drop_flag_reset_block ( DropFlagMode :: Shallow , self . succ , self . unwind ) , self . unwind )
356
346
}
357
347
358
348
/// Creates a full drop ladder, consisting of 2 connected half-drop-ladders
@@ -884,11 +874,7 @@ where
884
874
self . open_drop_for_adt ( def, substs)
885
875
}
886
876
}
887
- ty:: Dynamic ( ..) => {
888
- let unwind = self . unwind ; // FIXME(#43234)
889
- let succ = self . succ ;
890
- self . complete_drop ( Some ( DropFlagMode :: Deep ) , succ, unwind)
891
- }
877
+ ty:: Dynamic ( ..) => self . complete_drop ( self . succ , self . unwind ) ,
892
878
ty:: Array ( ety, size) => {
893
879
let size = size. try_eval_usize ( self . tcx ( ) , self . elaborator . param_env ( ) ) ;
894
880
self . open_drop_for_array ( ety, size)
@@ -899,20 +885,10 @@ where
899
885
}
900
886
}
901
887
902
- fn complete_drop (
903
- & mut self ,
904
- drop_mode : Option < DropFlagMode > ,
905
- succ : BasicBlock ,
906
- unwind : Unwind ,
907
- ) -> BasicBlock {
908
- debug ! ( "complete_drop({:?},{:?})" , self , drop_mode) ;
888
+ fn complete_drop ( & mut self , succ : BasicBlock , unwind : Unwind ) -> BasicBlock {
889
+ debug ! ( "complete_drop(succ={:?}, unwind={:?})" , succ, unwind) ;
909
890
910
891
let drop_block = self . drop_block ( succ, unwind) ;
911
- let drop_block = if let Some ( mode) = drop_mode {
912
- self . drop_flag_reset_block ( mode, drop_block, unwind)
913
- } else {
914
- drop_block
915
- } ;
916
892
917
893
self . drop_flag_test_block ( drop_block, succ, unwind)
918
894
}
@@ -927,6 +903,11 @@ where
927
903
) -> BasicBlock {
928
904
debug ! ( "drop_flag_reset_block({:?},{:?})" , self , mode) ;
929
905
906
+ if unwind. is_cleanup ( ) {
907
+ // The drop flag isn't read again on the unwind path, so don't
908
+ // bother setting it.
909
+ return succ;
910
+ }
930
911
let block = self . new_block ( unwind, TerminatorKind :: Goto { target : succ } ) ;
931
912
let block_start = Location { block, statement_index : 0 } ;
932
913
self . elaborator . clear_drop_flag ( block_start, self . path , mode) ;
@@ -1044,11 +1025,6 @@ where
1044
1025
self . elaborator . patch ( ) . new_temp ( ty, self . source_info . span )
1045
1026
}
1046
1027
1047
- fn terminator_loc ( & mut self , bb : BasicBlock ) -> Location {
1048
- let body = self . elaborator . body ( ) ;
1049
- self . elaborator . patch ( ) . terminator_loc ( body, bb)
1050
- }
1051
-
1052
1028
fn constant_usize ( & self , val : u16 ) -> Operand < ' tcx > {
1053
1029
Operand :: Constant ( box Constant {
1054
1030
span : self . source_info . span ,
0 commit comments