@@ -564,14 +564,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
564564 let source_info = scope. source_info ( span) ;
565565 block = match scope. cached_exits . entry ( ( target, region_scope) ) {
566566 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 ( ) ) ;
569568 return ;
570569 }
571570 Entry :: Vacant ( v) => {
572571 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) ;
575573 v. insert ( b) ;
576574 b
577575 }
@@ -596,8 +594,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
596594 scope = next_scope;
597595 }
598596
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) ;
601598 }
602599
603600 /// Creates a path that performs all required cleanup for dropping a generator.
@@ -616,14 +613,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
616613
617614 while let Some ( scope) = scopes. next ( ) {
618615 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) ;
621617 return Some ( result) ;
622618 } else {
623619 let b = self . cfg . start_new_block ( ) ;
624620 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) ;
627622 b
628623 } ;
629624
@@ -1243,8 +1238,7 @@ fn build_diverge_scope<'tcx>(cfg: &mut CFG<'tcx>,
12431238 // block for our StorageDead statements.
12441239 let block = cfg. start_new_cleanup_block ( ) ;
12451240 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) ;
12481242 target = block;
12491243 target_built_by_us = true ;
12501244 }
0 commit comments