Repository navigation
descriptor, codegen: allow MessageSet extension field numbers up to i32::MAX - #810
Open
Divyansh151005 wants to merge 1 commit into
Open
Divyansh151005 wants to merge 1 commit into
Divyansh151005 wants to merge 1 commit into
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
…::MAX Match protoc's relaxed field-number bound for extensions of message_set_wire_format messages in the pool linker and extension codegen.
Divyansh151005
force-pushed
the
fix/message-set-extension-field-number-702
branch
from
October 29, 2026 15:01
ec91f20 to
8cda375
Compare
This branch has not been deployed
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.
Fixes #702.
What this does
MessageSet extensions carry their type id as an
int32, so protoc allows extension numbers up toi32::MAXon messages withmessage_set_wire_format = true. buffa previously capped every extension at(1 << 29) - 1in bothDescriptorPool::link_extensionand codegen forextend, so descriptors protoc accepts were rejected or failed to generate.This change passes a per-call upper bound into
link_field:i32::MAXwhen the extendee is a MessageSet, otherwiseMAX_FIELD_NUMBER. Codegen uses the same rule viavalidated_extension_field_number, resolving the extendee message in the input descriptor set.Testing
Rust 1.95.0 (
rust-toolchain.toml).Results: both unit tests passed (
message_set_extension_const_uses_large_field_number,message_set_extension_above_max_field_number_links); fmt and clippy completed with no warnings.