add is_sized method on Abi and Layout, and use it

This commit is contained in:
Ralf Jung 2022-11-13 12:14:59 +01:00
parent 87237cb699
commit 358419cc25

View File

@ -277,7 +277,7 @@ pub fn struct_fields<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, layout: TyAndLayout
offset = target_offset + field.size; offset = target_offset + field.size;
prev_effective_align = effective_field_align; prev_effective_align = effective_field_align;
} }
if !layout.is_unsized() && field_count > 0 { if layout.is_sized() && field_count > 0 {
if offset > layout.size { if offset > layout.size {
bug!("layout: {:#?} stride: {:?} offset: {:?}", layout, layout.size, offset); bug!("layout: {:#?} stride: {:?} offset: {:?}", layout, layout.size, offset);
} }