about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorouz-a <oguz.agcayazi@gmail.com>2022-04-05 22:38:03 +0300
committerouz-a <oguz.agcayazi@gmail.com>2022-04-05 22:38:03 +0300
commit1cf6d6940c6e1368c76d2565ce13aeaa7e70a4b7 (patch)
tree1d977e3f96cdf8e321a2de11fd5838e9bc507525 /compiler/rustc_mir_transform/src
parent72070d8103ee2085129075852d318c91e0fcd292 (diff)
downloadrust-1cf6d6940c6e1368c76d2565ce13aeaa7e70a4b7.tar.gz
rust-1cf6d6940c6e1368c76d2565ce13aeaa7e70a4b7.zip
kill temp early
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/deref_separator.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/deref_separator.rs b/compiler/rustc_mir_transform/src/deref_separator.rs
index e62153fd92e..79aac163550 100644
--- a/compiler/rustc_mir_transform/src/deref_separator.rs
+++ b/compiler/rustc_mir_transform/src/deref_separator.rs
@@ -8,7 +8,6 @@ pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
     let mut patch = MirPatch::new(body);
     let (basic_blocks, local_decl) = body.basic_blocks_and_local_decls_mut();
     for (block, data) in basic_blocks.iter_enumerated_mut() {
-        let statement_len = data.statements.len();
         for (i, stmt) in data.statements.iter_mut().enumerate() {
             match stmt.kind {
                 StatementKind::Assign(box (og_place, Rvalue::Ref(region, borrow_knd, place))) => {
@@ -49,7 +48,7 @@ pub fn deref_finder<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
                             *stmt = new_stmt;
 
                             // Since our job with the temp is done it should be gone
-                            let loc = Location { block: block, statement_index: statement_len };
+                            let loc = Location { block: block, statement_index: i + 1 };
                             patch.add_statement(loc, StatementKind::StorageDead(temp));
 
                             // As all projections are off the base projection, if there are