@@ -438,7 +438,7 @@ impl<'a,'tcx> Builder<'a,'tcx> {
438
438
// generate B0 <- B1 <- B2 in left-to-right order. Control flow of the generated blocks
439
439
// always ends up at a block with the Resume terminator.
440
440
if scopes. iter ( ) . any ( |scope| !scope. drops . is_empty ( ) || scope. free . is_some ( ) ) {
441
- Some ( build_diverge_scope ( hir. tcx ( ) , cfg, & unit_temp, scopes) )
441
+ Some ( build_diverge_scope ( hir. tcx ( ) , self . fn_span , cfg, & unit_temp, scopes) )
442
442
} else {
443
443
None
444
444
}
@@ -611,6 +611,7 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>,
611
611
}
612
612
613
613
fn build_diverge_scope < ' tcx > ( tcx : & TyCtxt < ' tcx > ,
614
+ fn_span : Span ,
614
615
cfg : & mut CFG < ' tcx > ,
615
616
unit_temp : & Lvalue < ' tcx > ,
616
617
scopes : & mut [ Scope < ' tcx > ] )
@@ -639,11 +640,11 @@ fn build_diverge_scope<'tcx>(tcx: &TyCtxt<'tcx>,
639
640
// Diverging from the root scope creates a RESUME terminator.
640
641
// FIXME what span to use here?
641
642
let resumeblk = cfg. start_new_cleanup_block ( ) ;
642
- cfg. terminate ( resumeblk, scope. id , DUMMY_SP , TerminatorKind :: Resume ) ;
643
+ cfg. terminate ( resumeblk, scope. id , fn_span , TerminatorKind :: Resume ) ;
643
644
resumeblk
644
645
} else {
645
646
// Diverging from any other scope chains up to the previous scope.
646
- build_diverge_scope ( tcx, cfg, unit_temp, earlier_scopes)
647
+ build_diverge_scope ( tcx, fn_span , cfg, unit_temp, earlier_scopes)
647
648
} ;
648
649
scope. cached_block = Some ( target) ;
649
650
0 commit comments