@@ -4,7 +4,7 @@ use rustc_middle::mir::coverage::{BlockMarkerId, BranchSpan, CoverageKind};
44use rustc_middle:: mir:: { self , BasicBlock , SourceInfo , Statement , StatementKind } ;
55use rustc_middle:: ty:: TyCtxt ;
66use rustc_span:: def_id:: LocalDefId ;
7- use rustc_span:: { ExpnKind , Span } ;
7+ use rustc_span:: { ExpnKind , Span , DUMMY_SP } ;
88
99use crate :: build:: Builder ;
1010
@@ -151,13 +151,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
151151 pub ( crate ) fn coverage_add_branch (
152152 & mut self ,
153153 cond_source_info : SourceInfo ,
154- then_blk : BasicBlock ,
155- else_blk : BasicBlock ,
154+ then_blk : & mut BasicBlock ,
155+ else_blk : & mut BasicBlock ,
156156 ) {
157157 let hir_info_builder = self . coverage . as_mut ( ) . unwrap ( ) ;
158158 assert ! ( hir_info_builder. branch_coverage_enabled) ;
159159
160- let mut inject_branch_marker = |bb : BasicBlock | {
160+ let mut inject_branch_marker = |bb : & mut BasicBlock | {
161161 let id = hir_info_builder. next_block_marker_id ( ) ;
162162
163163 let statement = Statement {
@@ -167,7 +167,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
167167 } ) ) ,
168168 } ;
169169
170- self . cfg . push ( bb, statement) ;
170+ self . cfg . push ( * bb, statement) ;
171+ let successor_block = self . cfg . start_new_block ( ) ;
172+ self . cfg . goto ( * bb, SourceInfo :: outermost ( DUMMY_SP ) , successor_block) ;
173+ * bb = successor_block;
171174 id
172175 } ;
173176
0 commit comments