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> {
244
244
self . new_blocks. len( ) ,
245
245
body. basic_blocks. len( )
246
246
) ;
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 ( ) {
248
248
body. basic_blocks . as_mut_preserves_cfg ( )
249
249
} else {
250
250
body. basic_blocks . as_mut ( )
@@ -273,8 +273,8 @@ impl<'tcx> MirPatch<'tcx> {
273
273
}
274
274
debug ! ( "MirPatch: adding statement {:?} at loc {:?}+{}" , stmt, loc, delta) ;
275
275
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 ]
278
278
. statements
279
279
. insert ( loc. statement_index , Statement :: new ( source_info, stmt) ) ;
280
280
delta += 1 ;
You can’t perform that action at this time.
0 commit comments