@@ -564,14 +564,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
564
564
let source_info = scope. source_info ( span) ;
565
565
block = match scope. cached_exits . entry ( ( target, region_scope) ) {
566
566
Entry :: Occupied ( e) => {
567
- self . cfg . terminate ( block, source_info,
568
- TerminatorKind :: Goto { target : * e. get ( ) } ) ;
567
+ self . cfg . goto ( block, source_info, * e. get ( ) ) ;
569
568
return ;
570
569
}
571
570
Entry :: Vacant ( v) => {
572
571
let b = self . cfg . start_new_block ( ) ;
573
- self . cfg . terminate ( block, source_info,
574
- TerminatorKind :: Goto { target : b } ) ;
572
+ self . cfg . goto ( block, source_info, b) ;
575
573
v. insert ( b) ;
576
574
b
577
575
}
@@ -596,8 +594,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
596
594
scope = next_scope;
597
595
}
598
596
599
- let source_info = self . scopes . source_info ( scope_count, span) ;
600
- self . cfg . terminate ( block, source_info, TerminatorKind :: Goto { target } ) ;
597
+ self . cfg . goto ( block, self . scopes . source_info ( scope_count, span) , target) ;
601
598
}
602
599
603
600
/// Creates a path that performs all required cleanup for dropping a generator.
@@ -616,14 +613,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
616
613
617
614
while let Some ( scope) = scopes. next ( ) {
618
615
block = if let Some ( b) = scope. cached_generator_drop {
619
- self . cfg . terminate ( block, src_info,
620
- TerminatorKind :: Goto { target : b } ) ;
616
+ self . cfg . goto ( block, src_info, b) ;
621
617
return Some ( result) ;
622
618
} else {
623
619
let b = self . cfg . start_new_block ( ) ;
624
620
scope. cached_generator_drop = Some ( b) ;
625
- self . cfg . terminate ( block, src_info,
626
- TerminatorKind :: Goto { target : b } ) ;
621
+ self . cfg . goto ( block, src_info, b) ;
627
622
b
628
623
} ;
629
624
@@ -1243,8 +1238,7 @@ fn build_diverge_scope<'tcx>(cfg: &mut CFG<'tcx>,
1243
1238
// block for our StorageDead statements.
1244
1239
let block = cfg. start_new_cleanup_block ( ) ;
1245
1240
let source_info = SourceInfo { span : DUMMY_SP , scope : source_scope } ;
1246
- cfg. terminate ( block, source_info,
1247
- TerminatorKind :: Goto { target : target } ) ;
1241
+ cfg. goto ( block, source_info, target) ;
1248
1242
target = block;
1249
1243
target_built_by_us = true ;
1250
1244
}
0 commit comments