diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index 1f38433fa5a4..92556e7c5f6c 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -277,7 +277,6 @@ impl<'tcx> MutVisitor<'tcx> for Merger<'tcx> { if self.merged_locals.contains(*local) => { statement.make_nop(true); - return; } _ => (), }; diff --git a/tests/mir-opt/debuginfo/dest_prop.remap_debuginfo_locals.DestinationPropagation.diff b/tests/mir-opt/debuginfo/dest_prop.remap_debuginfo_locals.DestinationPropagation.diff index 6f3233d85c9f..fe00da67e8bb 100644 --- a/tests/mir-opt/debuginfo/dest_prop.remap_debuginfo_locals.DestinationPropagation.diff +++ b/tests/mir-opt/debuginfo/dest_prop.remap_debuginfo_locals.DestinationPropagation.diff @@ -9,11 +9,12 @@ let mut _4: bool; bb0: { - // DBG: _3 = &_1; +- // DBG: _3 = &_1; - StorageLive(_4); - _4 = copy _1; - _3 = copy _2; - switchInt(copy _4) -> [1: bb1, otherwise: bb2]; ++ // DBG: _2 = &_1; + nop; + nop; + nop; diff --git a/tests/mir-opt/debuginfo/dest_prop.rs b/tests/mir-opt/debuginfo/dest_prop.rs index 9c9d95ebfb3f..a734cacb4d29 100644 --- a/tests/mir-opt/debuginfo/dest_prop.rs +++ b/tests/mir-opt/debuginfo/dest_prop.rs @@ -1,4 +1,3 @@ -// skip-filecheck //@ test-mir-pass: DestinationPropagation //@ compile-flags: -g -Zmir-enable-passes=+DeadStoreElimination-initial @@ -10,6 +9,10 @@ use std::intrinsics::mir::*; // EMIT_MIR dest_prop.remap_debuginfo_locals.DestinationPropagation.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] pub fn remap_debuginfo_locals(a: bool, b: &bool) -> &bool { + // CHECK-LABEL: fn remap_debuginfo_locals( + // CHECK: debug c => [[c:_.*]]; + // CHECK: bb0: + // CHECK-NEXT: DBG: [[c]] = &_1; mir! { let _3: &bool; let _4: bool; diff --git a/tests/crashes/147485-2.rs b/tests/ui/debuginfo/dest_prop_debuginfo-147485.rs similarity index 81% rename from tests/crashes/147485-2.rs rename to tests/ui/debuginfo/dest_prop_debuginfo-147485.rs index da092a3af76a..652660d473b1 100644 --- a/tests/crashes/147485-2.rs +++ b/tests/ui/debuginfo/dest_prop_debuginfo-147485.rs @@ -1,6 +1,8 @@ -//@ known-bug: #147485 +//@ build-pass //@ compile-flags: -g -O +// Regression test for #147485. + #![crate_type = "lib"] pub fn foo(a: bool, b: bool) -> bool {