File tree 2 files changed +6
-7
lines changed
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,11 @@ impl<'tcx> Body<'tcx> {
426
426
( arg_count + 1 ..local_count) . map ( Local :: new)
427
427
}
428
428
429
+ #[ inline]
430
+ pub fn drain_vars_and_temps < ' a > ( & ' a mut self ) -> impl Iterator < Item = LocalDecl < ' tcx > > + ' a {
431
+ self . local_decls . drain ( self . arg_count + 1 ..)
432
+ }
433
+
429
434
/// Changes a statement to a nop. This is both faster than deleting instructions and avoids
430
435
/// invalidating statement indices in `Location`s.
431
436
pub fn make_statement_nop ( & mut self , location : Location ) {
Original file line number Diff line number Diff line change @@ -607,13 +607,7 @@ impl Inliner<'tcx> {
607
607
}
608
608
609
609
// Insert all of the (mapped) parts of the callee body into the caller.
610
- caller_body. local_decls . extend (
611
- // FIXME(eddyb) make `Range<Local>` iterable so that we can use
612
- // `callee_body.local_decls.drain(callee_body.vars_and_temps())`
613
- callee_body
614
- . vars_and_temps_iter ( )
615
- . map ( |local| callee_body. local_decls [ local] . clone ( ) ) ,
616
- ) ;
610
+ caller_body. local_decls . extend ( callee_body. drain_vars_and_temps ( ) ) ;
617
611
caller_body. source_scopes . extend ( & mut callee_body. source_scopes . drain ( ..) ) ;
618
612
caller_body. var_debug_info . append ( & mut callee_body. var_debug_info ) ;
619
613
caller_body. basic_blocks_mut ( ) . extend ( callee_body. basic_blocks_mut ( ) . drain ( ..) ) ;
You can’t perform that action at this time.
0 commit comments