diff --git a/src/interpreter.rs b/src/interpreter.rs index ff54f18f755f..2ccd5adeecbf 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -576,7 +576,7 @@ impl<'a, 'tcx: 'a> Interpreter<'a, 'tcx> { }; Repr::Aggregate { discr_size: discr_size, - max_variant_size: max_variant_size, + size: max_variant_size + discr_size, variants: variants, } diff --git a/src/memory.rs b/src/memory.rs index a2632007d802..667f28e987c2 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -54,8 +54,8 @@ pub enum Repr { /// structs and tuples. discr_size: usize, - /// The size of the largest variant in bytes. - max_variant_size: usize, + /// The size of the entire aggregate, including the discriminant. + size: usize, /// The representations of the contents of each variant. variants: Vec>, @@ -366,7 +366,7 @@ impl Repr { pub fn size(&self) -> usize { match *self { Repr::Primitive { size } => size, - Repr::Aggregate { discr_size, max_variant_size, .. } => discr_size + max_variant_size, + Repr::Aggregate { size, .. } => size, Repr::Array { elem_size, length } => elem_size * length, Repr::Pointer => POINTER_SIZE, Repr::FatPointer => POINTER_SIZE * 2,