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

Prevent serde from bringing in std unless the std feature is enabled for this crate #499

Merged
merged 3 commits into from
Aug 17, 2023

Conversation

eranrund
Copy link
Contributor

I ran into an issue using this crate in a no_std build where I wanted to have serde enabled, but without std. The change here addresses that.
Thank you!

Cargo.toml Outdated
@@ -11,7 +11,7 @@ rust-version = "1.60.0"

[dependencies]
arrayvec = { version = "0.7", default-features = false }
serde = { version = "1.0.183", optional = true }
serde = { version = "1.0.183", default-features = false, features = ["alloc", "derive"], optional = true }
Copy link
Member

Choose a reason for hiding this comment

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

So we dont actually need the alloc and derive features at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting, potentially no. This got me looking into how serde is used and it looks like it's actually gated by the std feature?
https://github.com/paritytech/parity-scale-codec/blob/master/src/compact.rs#L195-L196
Seems like that should change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I pushed a change that always includes serde, even if std isn't enabled. I think that should work...

Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
src/compact.rs Show resolved Hide resolved
src/compact.rs Show resolved Hide resolved
Co-authored-by: Bastian Köcher <git@kchr.de>
@bkchr
Copy link
Member

bkchr commented Aug 17, 2023

@eranrund did you checked that it still compiles?

@eranrund
Copy link
Contributor Author

@eranrund did you checked that it still compiles?

I did, not seeing any issues.

@bkchr bkchr merged commit 4cbd87b into paritytech:master Aug 17, 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.

3 participants