-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Description
bcachefs uses types that are both packed and aligned (to 4 or 8 bytes). We're looking to expand our use of Rust, and we need these types available via bindgen - they're our on disk format, so not easily changed.
Right now we're making this work via a bindgen patch that strips off aligned when packed is specified; however, this is incorrect and a lurking bug since specifying the alignment of at type can change the size - thus, Rust and C may end up disagreeing about the size and layout of these types.
Additionally, specifying aligned may give rustc additional useful information - in a packed, aligned(4) type, members up to 4 byte alignment may still be aligned correctly (depending on struct layout), whereas in a packed type rustc would not be able to assume that.