diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-12-29 19:15:00 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-01-27 18:22:44 +0000 |
| commit | 982726cdc4c291b88f1099f49e573a1a6de078ff (patch) | |
| tree | 99617b051cd1b6423ef7bec93dcba682707f4c53 /compiler | |
| parent | 8f7e441a547ee2d70d9401502171e944d6e5e797 (diff) | |
| download | rust-982726cdc4c291b88f1099f49e573a1a6de078ff.tar.gz rust-982726cdc4c291b88f1099f49e573a1a6de078ff.zip | |
Consider `CopyForDeref` for DestProp.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_transform/src/dest_prop.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index 08e296a8371..91428fd0864 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -328,7 +328,8 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Merger<'a, 'tcx> { match &statement.kind { StatementKind::Assign(box (dest, rvalue)) => { match rvalue { - Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) => { + Rvalue::CopyForDeref(place) + | Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) => { // These might've been turned into self-assignments by the replacement // (this includes the original statement we wanted to eliminate). if dest == place { @@ -754,7 +755,7 @@ impl<'tcx> Visitor<'tcx> for FindAssignments<'_, '_, 'tcx> { fn visit_statement(&mut self, statement: &Statement<'tcx>, _: Location) { if let StatementKind::Assign(box ( lhs, - Rvalue::Use(Operand::Copy(rhs) | Operand::Move(rhs)), + Rvalue::CopyForDeref(rhs) | Rvalue::Use(Operand::Copy(rhs) | Operand::Move(rhs)), )) = &statement.kind { let Some((src, dest)) = places_to_candidate_pair(*lhs, *rhs, self.body) else { |
