File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
compiler/rustc_mir_transform/src Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ impl<'tcx> MirPatch<'tcx> {
244244 self . new_blocks. len( ) ,
245245 body. basic_blocks. len( )
246246 ) ;
247- let bbs = if self . term_patch_map . is_empty ( ) && self . new_blocks . is_empty ( ) {
247+ let bbs = if self . term_patch_map . iter ( ) . all ( Option :: is_none ) && self . new_blocks . is_empty ( ) {
248248 body. basic_blocks . as_mut_preserves_cfg ( )
249249 } else {
250250 body. basic_blocks . as_mut ( )
@@ -273,8 +273,8 @@ impl<'tcx> MirPatch<'tcx> {
273273 }
274274 debug ! ( "MirPatch: adding statement {:?} at loc {:?}+{}" , stmt, loc, delta) ;
275275 loc. statement_index += delta;
276- let source_info = Self :: source_info_for_index ( & body [ loc. block ] , loc) ;
277- body [ loc. block ]
276+ let source_info = Self :: source_info_for_index ( & bbs [ loc. block ] , loc) ;
277+ bbs [ loc. block ]
278278 . statements
279279 . insert ( loc. statement_index , Statement :: new ( source_info, stmt) ) ;
280280 delta += 1 ;
You can’t perform that action at this time.
0 commit comments