Skip to content

Commit 8811344

Browse files
committed
Elaborate comment.
1 parent aee7d70 commit 8811344

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/rustc_mir_transform/src/dest_prop.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,12 @@ fn save_as_intervals<'tcx>(
590590
twostep = TwoStepIndex::from_u32(twostep.as_u32() + 1);
591591
debug_assert_eq!(twostep, two_step_loc(loc, Effect::After));
592592
append_at(&mut values, &state, twostep);
593-
// Ensure we have a non-zero live range even for dead stores. This is done by marking
594-
// all the written-to locals as live in the second half of the statement.
593+
// Like terminators, ensure we have a non-zero live range even for dead stores.
594+
// Some rvalues interleave reads and writes, for instance `Rvalue::Aggregate`, see
595+
// https://github.com/rust-lang/rust/issues/146383. By precaution, treat statements
596+
// as behaving so by default.
597+
// We make an exception for simple assignments `_a.stuff = {copy|move} _b.stuff`,
598+
// as marking `_b` live here would prevent unification.
595599
let is_simple_assignment =
596600
matches!(stmt.kind, StatementKind::Assign(box (_, Rvalue::Use(_))));
597601
VisitPlacesWith(|place: Place<'tcx>, ctxt| {

0 commit comments

Comments
 (0)