about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorCamille Gillot <gillot.camille@gmail.com>2025-09-14 13:04:53 +0000
committerCamille Gillot <gillot.camille@gmail.com>2025-09-14 13:27:46 +0000
commit8811344f22e0c015aaa45367b6462e3ecdcb22b5 (patch)
tree3c31f52154cbf4f76e2eb63c7ca1103e8e8b2eb9 /compiler/rustc_mir_transform/src
parentaee7d703c58b68611785684bbb8e402c1471992b (diff)
downloadrust-8811344f22e0c015aaa45367b6462e3ecdcb22b5.tar.gz
rust-8811344f22e0c015aaa45367b6462e3ecdcb22b5.zip
Elaborate comment.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/dest_prop.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs
index 7e6f39881b8..b9ab0a9feee 100644
--- a/compiler/rustc_mir_transform/src/dest_prop.rs
+++ b/compiler/rustc_mir_transform/src/dest_prop.rs
@@ -590,8 +590,12 @@ fn save_as_intervals<'tcx>(
             twostep = TwoStepIndex::from_u32(twostep.as_u32() + 1);
             debug_assert_eq!(twostep, two_step_loc(loc, Effect::After));
             append_at(&mut values, &state, twostep);
-            // Ensure we have a non-zero live range even for dead stores. This is done by marking
-            // all the written-to locals as live in the second half of the statement.
+            // Like terminators, ensure we have a non-zero live range even for dead stores.
+            // Some rvalues interleave reads and writes, for instance `Rvalue::Aggregate`, see
+            // https://github.com/rust-lang/rust/issues/146383. By precaution, treat statements
+            // as behaving so by default.
+            // We make an exception for simple assignments `_a.stuff = {copy|move} _b.stuff`,
+            // as marking `_b` live here would prevent unification.
             let is_simple_assignment =
                 matches!(stmt.kind, StatementKind::Assign(box (_, Rvalue::Use(_))));
             VisitPlacesWith(|place: Place<'tcx>, ctxt| {