about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-16 07:12:47 +0200
committerGitHub <noreply@github.com>2022-04-16 07:12:47 +0200
commitab7fb29878826cc7278785ae1be28577826f5d18 (patch)
tree4b3025753889db25cfaa5db0bdf218d150b405bb /compiler/rustc_const_eval/src
parentfd7a1f153d2598e59ed7014f6ee7054a1e4ac8e4 (diff)
parent48029aba2c4a902fae9c6f028bceae5105979114 (diff)
Rollup merge of #96050 - oli-obk:deaggregator_cleanup, r=RalfJung
Remove some now-dead code that was only relevant before deaggregation.

The code was broken anyway, if the deaggregator is disabled, it would have ICEd on any non-enum Adt

r? ```@RalfJung```
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/interpret/step.rs22
1 files changed, 3 insertions, 19 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs
index eb1a184bf9b..e6dfdf54a32 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -196,27 +196,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 self.write_immediate(*val, &dest)?;
             }
 
-            Aggregate(ref kind, ref operands) => {
-                // active_field_index is for union initialization.
-                let (dest, active_field_index) = match **kind {
-                    mir::AggregateKind::Adt(adt_did, variant_index, _, _, active_field_index) => {
-                        self.write_discriminant(variant_index, &dest)?;
-                        if self.tcx.adt_def(adt_did).is_enum() {
-                            assert!(active_field_index.is_none());
-                            (self.place_downcast(&dest, variant_index)?, None)
-                        } else {
-                            if active_field_index.is_some() {
-                                assert_eq!(operands.len(), 1);
-                            }
-                            (dest, active_field_index)
-                        }
-                    }
-                    _ => (dest, None),
-                };
+            Aggregate(box ref kind, ref operands) => {
+                assert!(matches!(kind, mir::AggregateKind::Array(..)));
 
-                for (i, operand) in operands.iter().enumerate() {
+                for (field_index, operand) in operands.iter().enumerate() {
                     let op = self.eval_operand(operand, None)?;
-                    let field_index = active_field_index.unwrap_or(i);
                     let field_dest = self.place_field(&dest, field_index)?;
                     self.copy_op(&op, &field_dest)?;
                 }