Preserve forward-declared enum semantics in protobuf IR by adding is_incomplete boolean field to the Enum message. - #1431
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_947885916
branch
from
July 15, 2026 14:52
d4813f0 to
a92cd31
Compare
…_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
Bot
force-pushed
the
test_947885916
branch
from
July 15, 2026 15:08
a92cd31 to
342bf27
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preserve forward-declared enum semantics in protobuf IR by adding
is_incompleteboolean field to the Enum message.When converting from C++ IR to protobuf IR, if
Enum::enumeratorsdoes not have a value (an incomplete/forward-declared enum rather than a complete definition),is_incompleteis set to true. When deserializing inproto_to_ir.rs, ifis_incompleteis set,enumeratorsshould 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 ForwardDeclaredandenum Empty {}from &[T]