Skip to content

Preserve forward-declared enum semantics in protobuf IR by adding is_incomplete boolean field to the Enum message. - #1431

Merged
copybara-service[bot] merged 1 commit into
mainfrom
test_947885916
Jul 15, 2026
Merged

Preserve forward-declared enum semantics in protobuf IR by adding is_incomplete boolean field to the Enum message. #1431
copybara-service[bot] merged 1 commit into
mainfrom
test_947885916

Conversation

@copybara-service

Copy link
Copy Markdown

Preserve forward-declared enum semantics in protobuf IR by adding is_incomplete boolean field to the Enum message.

When converting from C++ IR to protobuf IR, if Enum::enumerators does not have a value (an incomplete/forward-declared enum rather than a complete definition), is_incomplete is set to true. When deserializing in proto_to_ir.rs, if is_incomplete is set, enumerators should be set to None instead of an empty, existent vector, which previously resulted in invalid bindings for opaque enums.

This should also matter once we migrate to wrap EnumView, since we'll have no way of distinguishing between enum ForwardDeclared and enum Empty {} from &[T]

…_incomplete` boolean field to the Enum message.

When converting from C++ IR to protobuf IR, if `Enum::enumerators` does not have a value (an incomplete/forward-declared enum rather than a complete definition), `is_incomplete` is set to true. When deserializing in `proto_to_ir.rs`, if `is_incomplete` is set, `enumerators` should be set to None instead of an empty, existent vector, which previously resulted in invalid bindings for opaque enums.

This should also matter once we migrate to wrap EnumView, since we'll have no way of distinguishing between `enum ForwardDeclared` and `enum Empty {}` from &[T]

PiperOrigin-RevId: 948341164
@copybara-service
copybara-service Bot merged commit 342bf27 into main Jul 15, 2026
@copybara-service
copybara-service Bot deleted the test_947885916 branch July 15, 2026 15:08
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