Skip to content

Commit 625af2c

Browse files
committed
Elide storage markers for internal locals when inlining
1 parent 162bd16 commit 625af2c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/rustc_mir_transform/src/inline.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,9 @@ impl<'tcx> Inliner<'tcx> {
616616
// If there are any locals without storage markers, give them storage only for the
617617
// duration of the call.
618618
for local in callee_body.vars_and_temps_iter() {
619-
if integrator.always_live_locals.contains(local) {
619+
if !callee_body.local_decls[local].internal
620+
&& integrator.always_live_locals.contains(local)
621+
{
620622
let new_local = integrator.map_local(local);
621623
caller_body[callsite.block].statements.push(Statement {
622624
source_info: callsite.source_info,
@@ -629,7 +631,9 @@ impl<'tcx> Inliner<'tcx> {
629631
// the slice once.
630632
let mut n = 0;
631633
for local in callee_body.vars_and_temps_iter().rev() {
632-
if integrator.always_live_locals.contains(local) {
634+
if !callee_body.local_decls[local].internal
635+
&& integrator.always_live_locals.contains(local)
636+
{
633637
let new_local = integrator.map_local(local);
634638
caller_body[block].statements.push(Statement {
635639
source_info: callsite.source_info,

0 commit comments

Comments
 (0)