@@ -22,7 +22,7 @@ use rustc::util::nodemap::FxHashMap;
22
22
use rustc_data_structures:: indexed_set:: IdxSetBuf ;
23
23
use rustc_data_structures:: indexed_vec:: Idx ;
24
24
use 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} ;
26
26
use rustc_mir:: util:: elaborate_drops:: { DropElaborator , DropStyle , DropFlagMode } ;
27
27
use syntax:: ast;
28
28
use syntax_pos:: Span ;
@@ -399,14 +399,13 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
399
399
ctxt : self
400
400
} ,
401
401
terminator. source_info ,
402
- data. is_cleanup ,
403
402
location,
404
403
path,
405
404
target,
406
405
if data. is_cleanup {
407
- None
406
+ Unwind :: InCleanup
408
407
} else {
409
- Some ( Option :: unwrap_or ( unwind, resume_block) )
408
+ Unwind :: To ( Option :: unwrap_or ( unwind, resume_block) )
410
409
} ,
411
410
bb)
412
411
}
@@ -455,6 +454,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
455
454
let bb = loc. block ;
456
455
let data = & self . mir [ bb] ;
457
456
let terminator = data. terminator ( ) ;
457
+ assert ! ( !data. is_cleanup, "DropAndReplace in unwind path not supported" ) ;
458
458
459
459
let assign = Statement {
460
460
kind : StatementKind :: Assign ( location. clone ( ) , Rvalue :: Use ( value. clone ( ) ) ) ,
@@ -477,7 +477,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
477
477
kind : TerminatorKind :: Goto { target : target } ,
478
478
..* terminator
479
479
} ) ,
480
- is_cleanup : data . is_cleanup ,
480
+ is_cleanup : false ,
481
481
} ) ;
482
482
483
483
match self . move_data ( ) . rev_lookup . find ( location) {
@@ -491,11 +491,10 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
491
491
ctxt : self
492
492
} ,
493
493
terminator. source_info ,
494
- data. is_cleanup ,
495
494
location,
496
495
path,
497
496
target,
498
- Some ( unwind) ,
497
+ Unwind :: To ( unwind) ,
499
498
bb) ;
500
499
on_all_children_bits ( self . tcx , self . mir , self . move_data ( ) , path, |child| {
501
500
self . set_drop_flag ( Location { block : target, statement_index : 0 } ,
0 commit comments