-
Notifications
You must be signed in to change notification settings - Fork 735
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
No way to enable serde for no-std builds #904
Comments
I think we can solve your problem by disabling default-features in the For example this toy crate builds,
And main.rs
Does that work for you? [1] - I don't know the correct term for this but I mean features enabled in one place are enabled for the whole build. |
Ah yes, this would work 👍 The trade-off is that other projects will lose |
I've opened a PR to disable Serde's default-features: #905 |
I believe this issue may be closed |
Thanks Dan! Had a quick squiz at our toml and a few serde tomls - all looks sane from my brief look. |
Since Serde depends on
std/alloc
by default, and conditional features are not possible in the manifest, there is presently no way to enable theserde
feature for no-std builds.@tcharding had a suggestion (#896 (comment)) to let a dependent crate disable default features, and explicitly enable the necessary sub features; e.g.
serde/alloc
in this case. Unfortunately, cargo does not allow specifying sub-crate features, unless those features are explicitly reexported 🤮 :Instead of exhaustively reexporting sub-crate features, I think it would make sense in this case (and possibly others?) to replace the
use-serde
feature with two variants forstd
andno-std
builds:I have made this change on my fork, if anyone would like to see it in action: ass3rt@cc35a6e
Does this sound like a reasonable change?
Would it make sense to do this for other features as well? (e.g. #830)
Does anyone have a better idea how
serde
can be enabled on a pure no-std build?The text was updated successfully, but these errors were encountered: