diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-08-11 22:46:59 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-11 22:46:59 +0530 |
| commit | 32bd147f797a03922928f45bc6705daeefb7e9a4 (patch) | |
| tree | ae0440255e20effc612b313c129e9c75932ae4b3 /compiler/rustc_mir_transform | |
| parent | d749914f79d0a407ba87858a740f4f4c3d3ad9a7 (diff) | |
| parent | 7d2131a2048521ee1dfc41a12b2f5007effc1f26 (diff) | |
| download | rust-32bd147f797a03922928f45bc6705daeefb7e9a4.tar.gz rust-32bd147f797a03922928f45bc6705daeefb7e9a4.zip | |
Rollup merge of #100192 - tmiasko:rm-duplicated-locals, r=nagisa
Remove duplicated temporaries creating during box derefs elaboration Temporaries created with `MirPatch::new_temp` will be declared after patch application. Remove manually created duplicate declarations. Removing duplicates exposes another issue. Visitor elaborates terminator twice and attempts to access new, but not yet available, local declarations. Remove duplicated call to `visit_terminator`. Extracted from #99946.
Diffstat (limited to 'compiler/rustc_mir_transform')
| -rw-r--r-- | compiler/rustc_mir_transform/src/elaborate_box_derefs.rs | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs index 76b4cdd2ecd..76522233689 100644 --- a/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs +++ b/compiler/rustc_mir_transform/src/elaborate_box_derefs.rs @@ -70,7 +70,6 @@ impl<'tcx, 'a> MutVisitor<'tcx> for ElaborateBoxDerefVisitor<'tcx, 'a> { build_ptr_tys(tcx, base_ty.boxed_ty(), self.unique_did, self.nonnull_did); let ptr_local = self.patch.new_temp(ptr_ty, source_info.span); - self.local_decls.push(LocalDecl::new(ptr_ty, source_info.span)); self.patch.add_statement(location, StatementKind::StorageLive(ptr_local)); @@ -125,13 +124,6 @@ impl<'tcx> MirPass<'tcx> for ElaborateBoxDerefs { index += 1; } - if let Some(terminator) = terminator - && !matches!(terminator.kind, TerminatorKind::Yield{..}) - { - let location = Location { block, statement_index: index }; - visitor.visit_terminator(terminator, location); - } - let location = Location { block, statement_index: index }; match terminator { // yielding into a box is handled when lowering generators |
