@@ -1004,22 +1004,22 @@ fn trans_rvalue_stmt_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
1004
1004
debuginfo:: set_source_location ( bcx. fcx , expr. id , expr. span ) ;
1005
1005
let src_datum = unpack_datum ! (
1006
1006
bcx, src_datum. to_rvalue_datum( bcx, "ExprAssign" ) ) ;
1007
- if let Some ( hint_datum ) = dst_datum. kind . drop_flag_info . hint_datum ( bcx) {
1008
- let hint_val = hint_datum . to_value ( ) ;
1009
- // XXX the checkpointed branch only does the
1010
- // drop_ty call within this branch (and I claim
1011
- // that seems like a bug). At this point I have
1012
- // moved it into the branch solely to see if it
1013
- // makes my plague of bugs go away.
1014
- bcx = glue :: drop_ty_core ( bcx ,
1015
- dst_datum. val ,
1016
- dst_datum . ty ,
1017
- expr . debug_loc ( ) ,
1018
- false ,
1019
- Some ( hint_val ) ) ;
1020
- // We are initializing or overwriting the
1021
- // destination, so we need to write "drop needed "
1022
- // into the hint.
1007
+ let opt_hint_datum = dst_datum. kind . drop_flag_info . hint_datum ( bcx) ;
1008
+ let opt_hint_val = opt_hint_datum . map ( |d|d . to_value ( ) ) ;
1009
+
1010
+ // 1. Drop the data at the destination, passing the
1011
+ // drop-hint in case the lvalue has already been
1012
+ // dropped or moved.
1013
+ bcx = glue :: drop_ty_core ( bcx ,
1014
+ dst_datum . val ,
1015
+ dst_datum. ty ,
1016
+ expr . debug_loc ( ) ,
1017
+ false ,
1018
+ opt_hint_val ) ;
1019
+
1020
+ // 2. We are overwriting the destination; ensure that
1021
+ // its drop-hint (if any) says "initialized. "
1022
+ if let Some ( hint_val ) = opt_hint_val {
1023
1023
let hint_llval = hint_val. value ( ) ;
1024
1024
let drop_needed = C_u8 ( bcx. fcx . ccx , adt:: DTOR_NEEDED_HINT as usize ) ;
1025
1025
Store ( bcx, drop_needed, hint_llval) ;
0 commit comments