@@ -22,7 +22,7 @@ use rustc::util::nodemap::FxHashMap;
2222use rustc_data_structures:: indexed_set:: IdxSetBuf ;
2323use rustc_data_structures:: indexed_vec:: Idx ;
2424use rustc_mir:: util:: patch:: MirPatch ;
25- use rustc_mir:: util:: elaborate_drops:: { DropFlagState , elaborate_drop} ;
25+ use rustc_mir:: util:: elaborate_drops:: { DropFlagState , Unwind , elaborate_drop} ;
2626use rustc_mir:: util:: elaborate_drops:: { DropElaborator , DropStyle , DropFlagMode } ;
2727use syntax:: ast;
2828use syntax_pos:: Span ;
@@ -399,14 +399,13 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
399399 ctxt : self
400400 } ,
401401 terminator. source_info ,
402- data. is_cleanup ,
403402 location,
404403 path,
405404 target,
406405 if data. is_cleanup {
407- None
406+ Unwind :: InCleanup
408407 } else {
409- Some ( Option :: unwrap_or ( unwind, resume_block) )
408+ Unwind :: To ( Option :: unwrap_or ( unwind, resume_block) )
410409 } ,
411410 bb)
412411 }
@@ -455,6 +454,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
455454 let bb = loc. block ;
456455 let data = & self . mir [ bb] ;
457456 let terminator = data. terminator ( ) ;
457+ assert ! ( !data. is_cleanup, "DropAndReplace in unwind path not supported" ) ;
458458
459459 let assign = Statement {
460460 kind : StatementKind :: Assign ( location. clone ( ) , Rvalue :: Use ( value. clone ( ) ) ) ,
@@ -477,7 +477,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
477477 kind : TerminatorKind :: Goto { target : target } ,
478478 ..* terminator
479479 } ) ,
480- is_cleanup : data . is_cleanup ,
480+ is_cleanup : false ,
481481 } ) ;
482482
483483 match self . move_data ( ) . rev_lookup . find ( location) {
@@ -491,11 +491,10 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
491491 ctxt : self
492492 } ,
493493 terminator. source_info ,
494- data. is_cleanup ,
495494 location,
496495 path,
497496 target,
498- Some ( unwind) ,
497+ Unwind :: To ( unwind) ,
499498 bb) ;
500499 on_all_children_bits ( self . tcx , self . mir , self . move_data ( ) , path, |child| {
501500 self . set_drop_flag ( Location { block : target, statement_index : 0 } ,
0 commit comments