bazel /
crubit /
5765bb80a9cb405f994291d635d5afa7b4db5439 Fix offset of fields represented as opaque blobs of bytes.
Crubit represents some C++ fields as opaque blobs of bytes in the
generated Rust structs. Today this happens for `[[no_unique_address]]`
fields. In the future, this may also happen for fields of an otherwise
unsupported C++ type.
The opaque blobs of bytes intentionally have no alignment (to precisely
control their size). Unfortunately, the offset of such fields may
depend on the alignment - the tests added by this CL illustrate the
scenarios where the offset of the generated Rust field might not match
the offset of the original C++ field.
This CL inserts an additional `__padding<N>` field as needed to fix the
offset of fields represented as opaque blobs of bytes.
PiperOrigin-RevId: 449354029
12 files changed