diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-02-18 09:57:13 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-02-18 09:57:13 +0000 |
| commit | 7213eaa1c06bc75e6730fd5a7dea869dbdf4bed1 (patch) | |
| tree | d42c2ce78dab2c64e414cf5e22cfed3dbab374c9 /compiler/rustc_mir_transform/src | |
| parent | 650683756f0ad9badfa08d2cd10e68c56dcef7a3 (diff) | |
| download | rust-7213eaa1c06bc75e6730fd5a7dea869dbdf4bed1.tar.gz rust-7213eaa1c06bc75e6730fd5a7dea869dbdf4bed1.zip | |
Flood aggregate assignments with `Top`.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/dataflow_const_prop.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs index f3ca2337e59..4dc1564ce3b 100644 --- a/compiler/rustc_mir_transform/src/dataflow_const_prop.rs +++ b/compiler/rustc_mir_transform/src/dataflow_const_prop.rs @@ -122,7 +122,10 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> { ) { match rvalue { Rvalue::Aggregate(kind, operands) => { - state.flood_with(target.as_ref(), self.map(), FlatSet::Bottom); + // If we assign `target = Enum::Variant#0(operand)`, + // we must make sure that all `target as Variant#i` are `Top`. + state.flood(target.as_ref(), self.map()); + if let Some(target_idx) = self.map().find(target.as_ref()) { let (variant_target, variant_index) = match **kind { AggregateKind::Tuple | AggregateKind::Closure(..) => { |
