Skip to content

Add "opaque blob of bytes" field also to bindings of #[repr(C)] enums.#563

Closed
copybara-service[bot] wants to merge 1 commit intomainfrom
test_875946440
Closed

Add "opaque blob of bytes" field also to bindings of #[repr(C)] enums.#563
copybara-service[bot] wants to merge 1 commit intomainfrom
test_875946440

Conversation

@copybara-service
Copy link

@copybara-service copybara-service bot commented Feb 27, 2026

Add "opaque blob of bytes" field also to bindings of #[repr(C)] enums.

In the future (in a follow-up CL) we plan to auto-generate
"constructors" that can create an enum instance by populating
an __opaque_blob_of_bytes field - see https://godbolt.org/z/7nETfcxax

This CL adds a __opaque_blob_of_bytes field to #[repr(C)] enums.
This helps to provide a consistent, unified "API" that future
enum "constructors" can used.

The new field has to be public, because otherwise Clang reports an error
saying that "anonymous union cannot contain a private data member".
Therefore to signify that the field is only meant for internal usage
this CL renames the field to __crubit_internal_blob_of_bytes.

In the future (in a follow-up CL) we plan to auto-generate
"constructors" that can create an `enum` instance by populating
an `__opaque_blob_of_bytes` field - see https://godbolt.org/z/7nETfcxax

This CL adds a `__opaque_blob_of_bytes` field to `#[repr(C)]` `enum`s.
This helps to provide a consistent, unified "API" that future
`enum` "constructors" can used.

The new field has to be public, because otherwise Clang reports an error
saying that "anonymous union cannot contain a private data member".
Therefore to signify that the field is only meant for internal usage
this CL renames the field to `__crubit_internal_blob_of_bytes`.

PiperOrigin-RevId: 875946440
@copybara-service copybara-service bot changed the title Add __opaque_blob_of_bytes also to bindings of #[repr(C)] enums. Add "opaque blob of bytes" field also to bindings of #[repr(C)] enums. Feb 27, 2026
@copybara-service copybara-service bot closed this Mar 5, 2026
@copybara-service copybara-service bot deleted the test_875946440 branch March 5, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant