Skip to content

Commit ab7fb29

Browse files
authored
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```
2 parents fd7a1f1 + 48029ab commit ab7fb29

File tree

1 file changed

+3
-19
lines changed
  • compiler/rustc_const_eval/src/interpret

1 file changed

+3
-19
lines changed

compiler/rustc_const_eval/src/interpret/step.rs

+3-19
Original file line numberDiff line numberDiff line change
@@ -196,27 +196,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
196196
self.write_immediate(*val, &dest)?;
197197
}
198198

199-
Aggregate(ref kind, ref operands) => {
200-
// active_field_index is for union initialization.
201-
let (dest, active_field_index) = match **kind {
202-
mir::AggregateKind::Adt(adt_did, variant_index, _, _, active_field_index) => {
203-
self.write_discriminant(variant_index, &dest)?;
204-
if self.tcx.adt_def(adt_did).is_enum() {
205-
assert!(active_field_index.is_none());
206-
(self.place_downcast(&dest, variant_index)?, None)
207-
} else {
208-
if active_field_index.is_some() {
209-
assert_eq!(operands.len(), 1);
210-
}
211-
(dest, active_field_index)
212-
}
213-
}
214-
_ => (dest, None),
215-
};
199+
Aggregate(box ref kind, ref operands) => {
200+
assert!(matches!(kind, mir::AggregateKind::Array(..)));
216201

217-
for (i, operand) in operands.iter().enumerate() {
202+
for (field_index, operand) in operands.iter().enumerate() {
218203
let op = self.eval_operand(operand, None)?;
219-
let field_index = active_field_index.unwrap_or(i);
220204
let field_dest = self.place_field(&dest, field_index)?;
221205
self.copy_op(&op, &field_dest)?;
222206
}

0 commit comments

Comments
 (0)