diff options
| author | Camille Gillot <gillot.camille@gmail.com> | 2025-09-16 01:22:10 +0000 | 
|---|---|---|
| committer | Camille Gillot <gillot.camille@gmail.com> | 2025-09-16 01:22:10 +0000 | 
| commit | d58061e6131f6141985faadb6794af540f81b1db (patch) | |
| tree | 990385a893c5b16c8b43b017446cb3fee79f334a /compiler/rustc_mir_transform | |
| parent | 8811344f22e0c015aaa45367b6462e3ecdcb22b5 (diff) | |
| download | rust-d58061e6131f6141985faadb6794af540f81b1db.tar.gz rust-d58061e6131f6141985faadb6794af540f81b1db.zip | |
Restrict simple assignment condition.
Diffstat (limited to 'compiler/rustc_mir_transform')
| -rw-r--r-- | compiler/rustc_mir_transform/src/dest_prop.rs | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index b9ab0a9feee..c57483a6811 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -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) { | 
