Skip to content

Commit

Permalink
Use field align if it's smaller than pack align
Browse files Browse the repository at this point in the history
Fixes #2695
  • Loading branch information
yshui authored and emilio committed Jan 12, 2024
1 parent 8fffbf8 commit 5ac0381
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bindgen/codegen/struct_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ impl<'a> StructLayoutTracker<'a> {
0
} else if !self.is_packed {
self.padding_bytes(field_layout)
} else if let Some(l) = self.known_type_layout {
} else if let Some(mut l) = self.known_type_layout {
if field_layout.align < l.align {
l.align = field_layout.align;
}
self.padding_bytes(l)
} else {
0
Expand Down

0 comments on commit 5ac0381

Please sign in to comment.