File tree 2 files changed +6
-16
lines changed
2 files changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -1365,17 +1365,6 @@ impl<'tcx> BasicBlockData<'tcx> {
1365
1365
self . terminator . as_mut ( ) . expect ( "invalid terminator state" )
1366
1366
}
1367
1367
1368
- pub fn retain_statements < F > ( & mut self , mut f : F )
1369
- where
1370
- F : FnMut ( & mut Statement < ' _ > ) -> bool ,
1371
- {
1372
- for s in & mut self . statements {
1373
- if !f ( s) {
1374
- s. make_nop ( ) ;
1375
- }
1376
- }
1377
- }
1378
-
1379
1368
pub fn visitable ( & self , index : usize ) -> & dyn MirVisitable < ' tcx > {
1380
1369
if index < self . statements . len ( ) { & self . statements [ index] } else { & self . terminator }
1381
1370
}
Original file line number Diff line number Diff line change @@ -393,12 +393,13 @@ impl<'tcx> MutVisitor<'tcx> for TransformVisitor<'tcx> {
393
393
394
394
fn visit_basic_block_data ( & mut self , block : BasicBlock , data : & mut BasicBlockData < ' tcx > ) {
395
395
// Remove StorageLive and StorageDead statements for remapped locals
396
- data. retain_statements ( |s| match s. kind {
397
- StatementKind :: StorageLive ( l) | StatementKind :: StorageDead ( l) => {
398
- !self . remap . contains ( l)
396
+ for s in & mut data. statements {
397
+ if let StatementKind :: StorageLive ( l) | StatementKind :: StorageDead ( l) = s. kind
398
+ && self . remap . contains ( l)
399
+ {
400
+ s. make_nop ( ) ;
399
401
}
400
- _ => true ,
401
- } ) ;
402
+ }
402
403
403
404
let ret_val = match data. terminator ( ) . kind {
404
405
TerminatorKind :: Return => {
You can’t perform that action at this time.
0 commit comments