Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(prost-build): Prevent repeated fields to be boxed #1237

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

caspermeijn
Copy link
Collaborator

@caspermeijn caspermeijn commented Feb 7, 2025

Repeated fields are stored in a Vec, and therefore they are already heap allocated.

BREAKING CHANGE: A repeated field that is manually marked as boxed was typed as Vec<Box<T>>. Those fields are now simply typed as Vec<T> to prevent double indirection. The boxed configuration is effectively ignored for repeated fields.

Copy link
Member

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I would maybe write a test as well?

Repeated fields are stored in a `Vec`, and therefore they are already heap allocated.

BREAKING CHANGE: A repeated field that is manually marked as boxed was typed as `Vec<Box<T>>`. Those fields are now simply typed as `Vec<T>` to prevent double indirection. The `boxed` configuration is effectively ignored for repeated fields.
@caspermeijn
Copy link
Collaborator Author

LGTM I would maybe write a test as well?

Good idea, added it.

@caspermeijn caspermeijn added this pull request to the merge queue Feb 18, 2025
Merged via the queue into tokio-rs:master with commit 846c452 Feb 18, 2025
16 checks passed
@caspermeijn caspermeijn deleted the boxed_and_repeated branch February 18, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants