Skip to content

Commit df2ff4f

Browse files
committed
check empty layout
1 parent ddc07fc commit df2ff4f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/codegen/struct_layout.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ impl<'a, 'ctx> StructLayoutTracker<'a, 'ctx> {
163163
}
164164

165165
fn padding_bytes(&self, layout: Layout) -> usize {
166-
if self.latest_offset % layout.align == 0 {
166+
if layout.align == 0 {
167+
warn!("try to padding bytes without layout");
168+
169+
0
170+
} else if self.latest_offset % layout.align == 0 {
167171
0
168172
} else {
169173
layout.align - (self.latest_offset % layout.align)

0 commit comments

Comments
 (0)