Skip to content

fix(serialize): Allow serialization of unsized types within Rc, Arc, and Cow #975

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

Merged
merged 1 commit into from
May 2, 2025

Conversation

gap-editor
Copy link
Contributor

Description

This PR relaxes the implicit Sized bound on the CanonicalSerialize and CanonicalDeserialize blanket implementations for Rc<T>, Arc<T>, and Cow<'_, T>.

Previously, these implementations required T: Sized, which prevented serialization/deserialization of types like Cow<'a, [U]> even when U implemented the necessary traits. This change adds the ?Sized bound to T in the relevant impl blocks within serialize/src/impls.rs, allowing these types to be used.

closes: #973


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to GitHub issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests - Note: Unit tests covering the ?Sized cases (e.g., Cow<'a, [T]>) should be added.
  • Updated relevant documentation in the code - Note: No specific documentation updates were required for this change.
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md - Note: A changelog entry needs to be added.
  • Re-reviewed Files changed in the GitHub PR explorer - Note: Please double-check the changes in serialize/src/impls.rs.

@gap-editor gap-editor requested review from a team as code owners April 18, 2025 09:13
@gap-editor gap-editor requested review from z-tech, Pratyush and mmagician and removed request for a team April 18, 2025 09:13
@gap-editor gap-editor changed the title Update impls.rs fix(serialize): Allow serialization of unsized types within Rc, Arc, and Cow Apr 18, 2025
@gap-editor
Copy link
Contributor Author

@z-tech @Pratyush @mmagician could you review this PR?

@z-tech
Copy link
Contributor

z-tech commented May 2, 2025

Hi, thank you for the excellent description and the accompanying issue #973.

I am curious what dynamically sized types you intend to support but otherwise see no issue with this change.

@Pratyush Pratyush added this pull request to the merge queue May 2, 2025
Merged via the queue into arkworks-rs:master with commit 876d24e May 2, 2025
37 checks passed
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.

Relax implicit Sized bound on some blanket impls
3 participants