about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2022-07-30 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2022-08-23 10:08:48 +0200
commit625af2cc7595e0908f4b557f59010f2eeda67de7 (patch)
tree3f312caa504b8b86159705d272b6eb7d240a255b /compiler/rustc_mir_transform
parent162bd16352e855a8df388b6af702af041e93fecb (diff)
downloadrust-625af2cc7595e0908f4b557f59010f2eeda67de7.tar.gz
rust-625af2cc7595e0908f4b557f59010f2eeda67de7.zip
Elide storage markers for internal locals when inlining
Diffstat (limited to 'compiler/rustc_mir_transform')
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 6704d3462f4..c478c17be76 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -616,7 +616,9 @@ impl<'tcx> Inliner<'tcx> {
                 // If there are any locals without storage markers, give them storage only for the
                 // duration of the call.
                 for local in callee_body.vars_and_temps_iter() {
-                    if integrator.always_live_locals.contains(local) {
+                    if !callee_body.local_decls[local].internal
+                        && integrator.always_live_locals.contains(local)
+                    {
                         let new_local = integrator.map_local(local);
                         caller_body[callsite.block].statements.push(Statement {
                             source_info: callsite.source_info,
@@ -629,7 +631,9 @@ impl<'tcx> Inliner<'tcx> {
                     // the slice once.
                     let mut n = 0;
                     for local in callee_body.vars_and_temps_iter().rev() {
-                        if integrator.always_live_locals.contains(local) {
+                        if !callee_body.local_decls[local].internal
+                            && integrator.always_live_locals.contains(local)
+                        {
                             let new_local = integrator.map_local(local);
                             caller_body[block].statements.push(Statement {
                                 source_info: callsite.source_info,