@@ -330,7 +330,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
330
330
debug ! ( "pop_scope({:?}, {:?})" , extent, block) ;
331
331
// We need to have `cached_block`s available for all the drops, so we call diverge_cleanup
332
332
// to make sure all the `cached_block`s are filled in.
333
- self . diverge_cleanup ( ) ;
333
+ self . diverge_cleanup ( extent . 1 . span ) ;
334
334
let scope = self . scopes . pop ( ) . unwrap ( ) ;
335
335
assert_eq ! ( scope. extent, extent. 0 ) ;
336
336
unpack ! ( block = build_scope_drops( & mut self . cfg,
@@ -607,7 +607,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
607
607
/// This path terminates in Resume. Returns the start of the path.
608
608
/// See module comment for more details. None indicates there’s no
609
609
/// cleanup to do at this point.
610
- pub fn diverge_cleanup ( & mut self ) -> Option < BasicBlock > {
610
+ pub fn diverge_cleanup ( & mut self , span : Span ) -> Option < BasicBlock > {
611
611
if !self . scopes . iter ( ) . any ( |scope| scope. needs_cleanup ) {
612
612
return None ;
613
613
}
@@ -641,7 +641,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
641
641
} ;
642
642
643
643
for scope in scopes. iter_mut ( ) . filter ( |s| s. needs_cleanup ) {
644
- target = build_diverge_scope ( hir. tcx ( ) , cfg, & unit_temp, scope, target) ;
644
+ target = build_diverge_scope ( hir. tcx ( ) , cfg, & unit_temp, span , scope, target) ;
645
645
}
646
646
Some ( target)
647
647
}
@@ -657,7 +657,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
657
657
}
658
658
let source_info = self . source_info ( span) ;
659
659
let next_target = self . cfg . start_new_block ( ) ;
660
- let diverge_target = self . diverge_cleanup ( ) ;
660
+ let diverge_target = self . diverge_cleanup ( span ) ;
661
661
self . cfg . terminate ( block, source_info,
662
662
TerminatorKind :: Drop {
663
663
location : location,
@@ -675,7 +675,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
675
675
value : Operand < ' tcx > ) -> BlockAnd < ( ) > {
676
676
let source_info = self . source_info ( span) ;
677
677
let next_target = self . cfg . start_new_block ( ) ;
678
- let diverge_target = self . diverge_cleanup ( ) ;
678
+ let diverge_target = self . diverge_cleanup ( span ) ;
679
679
self . cfg . terminate ( block, source_info,
680
680
TerminatorKind :: DropAndReplace {
681
681
location : location,
@@ -698,7 +698,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
698
698
let source_info = self . source_info ( span) ;
699
699
700
700
let success_block = self . cfg . start_new_block ( ) ;
701
- let cleanup = self . diverge_cleanup ( ) ;
701
+ let cleanup = self . diverge_cleanup ( span ) ;
702
702
703
703
self . cfg . terminate ( block, source_info,
704
704
TerminatorKind :: Assert {
@@ -767,6 +767,7 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>,
767
767
fn build_diverge_scope < ' a , ' gcx , ' tcx > ( tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
768
768
cfg : & mut CFG < ' tcx > ,
769
769
unit_temp : & Lvalue < ' tcx > ,
770
+ span : Span ,
770
771
scope : & mut Scope < ' tcx > ,
771
772
mut target : BasicBlock )
772
773
-> BasicBlock
0 commit comments