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 serdect usage #222

Merged
merged 1 commit into from
May 3, 2023
Merged

Fix serdect usage #222

merged 1 commit into from
May 3, 2023

Conversation

samtay
Copy link
Contributor

@samtay samtay commented May 3, 2023

If someone tries to use, e.g. serde_json as a serialization library with crypto-bigint UInts, currently this fails at runtime:

Error("serializer is human readable, which requires the `alloc` crate feature", line: 0, column: 0)

This arises from the serdect dependency. There's currently no way to pass the alloc flag down through crypto-bigint.

The proposed solution here just piggybacks on the crypto-bigint alloc flag to also pass it down to serdect, but only if that dependency has been realized. Another option would be to always always enable serdect/alloc when serde is requested:

alloc = []
serde = ["serdect/alloc"]

or offer a new feature altogether to keep all the user's options open:

alloc = []
serde = ["dep:serdect"]
serde-alloc = ["serde", "serdect/alloc"]

I think my changes here make the most sense, but let me know if you prefer one of those other options, or something I haven't thought of.

Copy link
Member

@tarcieri tarcieri left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@tarcieri tarcieri merged commit a5fe39b into RustCrypto:master May 3, 2023
@samtay samtay deleted the fix-serde branch May 3, 2023 01:35
@tarcieri tarcieri mentioned this pull request Sep 4, 2023
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.

2 participants