Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Restrict simple assignment condition.
  • Loading branch information
cjgillot committed Sep 16, 2025
commit d58061e6131f6141985faadb6794af540f81b1db
10 changes: 8 additions & 2 deletions compiler/rustc_mir_transform/src/dest_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,14 @@ fn save_as_intervals<'tcx>(
// 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(_))));
let is_simple_assignment = match stmt.kind {
StatementKind::Assign(box (
lhs,
Rvalue::CopyForDeref(rhs)
| Rvalue::Use(Operand::Copy(rhs) | Operand::Move(rhs)),
)) => lhs.projection == rhs.projection,
_ => false,
};
VisitPlacesWith(|place: Place<'tcx>, ctxt| {
if let Some(relevant) = relevant.shrink[place.local] {
match DefUse::for_place(place, ctxt) {
Expand Down
Loading