-
Notifications
You must be signed in to change notification settings - Fork 54
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
serde is not an optional dependency #42
Comments
That's probably because of: default = ["std"]
std = ["serde/std"] You can try setting |
Ah yes that does fix the problem. Thank you! |
Is this rust-lang/cargo#3494? |
Yeah, that seems like the same issue. Sadly, the feature to fix this isn't stable yet (although the stabilization RFC has been accepted). After looking at the source code again, I noticed that the std feature is not used at all (in the src code) currently. So maybe just removing the "std" feature from the default features and adding a notice to the README would be an option until then? |
I've seen projects with a |
I think the real reason for this feature is that serde can also be used with `!#[no_std]~. So someone that wants to this crate with ![no_std] together with serde would disable the std feature (but enable the serde featurure). |
Judging from how the Cargo.toml is written, I assumed that serde was supposed to be an optional dependency.
However, when inspecting cargo bloat for my project (which uses smol_str) I noticed a long compile time for serde.
I was able to reproduce with an empty project (just an empty src/lib.rs file):
Running
cargo check
shows that serde is compiled and running cargo bloat yields> cargo bloat --time -j 1 Time Crate 3.20s serde 0.39s smol_str
Just as an example for my larger project, serde is still among the top 7 contributors even tough I am not using it at all (and according to cargo tree only depend upon it trough smol_str).
> cargo bloat --time -j 1 Time Crate 9.99s syn 9.93s hir_def 5.41s rowan 4.40s basedb 3.59s logos_derive 3.49s regex_syntax 3.10s serde ...
I am using the latest stable version (rust 1.56.1 on linux/nixos). Is there any way to remove the serde dependency or am I missing something?
The text was updated successfully, but these errors were encountered: