Manually inline scalar_unit

This commit is contained in:
Jubilee Young 2023-12-16 01:43:40 -08:00
parent 6959818ec2
commit f116bc6e27

View File

@ -180,12 +180,6 @@ fn layout_of_struct_or_enum<
let dl = self.current_data_layout();
let dl = dl.borrow();
let scalar_unit = |value: Primitive| {
let size = value.size(dl);
assert!(size.bits() <= 128);
Scalar::Initialized { value, valid_range: WrappingRange::full(size) }
};
let (present_first, present_second) = {
let mut present_variants = variants
.iter_enumerated()
@ -678,7 +672,9 @@ struct TmpLayout<FieldIdx: Idx, VariantIdx: Idx> {
}
if let Some((prim, offset)) = common_prim {
let prim_scalar = if common_prim_initialized_in_all_variants {
scalar_unit(prim)
let size = prim.size(dl);
assert!(size.bits() <= 128);
Scalar::Initialized { value: prim, valid_range: WrappingRange::full(size) }
} else {
// Common prim might be uninit.
Scalar::Union { value: prim }