diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-07 17:13:58 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-11 16:29:41 +0000 |
| commit | b851e554ddf64d4889d305ee4d8972028bc86b90 (patch) | |
| tree | 70633fcb6d6610beff833f6d24520732bf740da8 /compiler/rustc_mir_transform/src | |
| parent | 82f0468009da17c14a3ab69d01526db848cf8b55 (diff) | |
| download | rust-b851e554ddf64d4889d305ee4d8972028bc86b90.tar.gz rust-b851e554ddf64d4889d305ee4d8972028bc86b90.zip | |
Support CopyForDeref.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/dataflow_const_prop.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index 5ec9d13f7d2..fc8eccb2705 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -119,6 +119,12 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> { self.assign_operand(state, target, operand); } } + Rvalue::CopyForDeref(rhs) => { + state.flood(target.as_ref(), self.map()); + if let Some(target) = self.map.find(target.as_ref()) { + self.assign_operand(state, target, &Operand::Copy(*rhs)); + } + } Rvalue::Aggregate(kind, operands) => { // If we assign `target = Enum::Variant#0(operand)`, // we must make sure that all `target as Variant#i` are `Top`. |
