You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because dev-dependencies are not allowed to be optional (cc @ehuss), I have to make serde_test an unconditional dev-dependency, which means that it will always be part of the dependency graph of my crate when building it, and because serde_test requires std, this means that building my crate ends up always linking against the standard library.
My crate is a #[no_std] crate, so I cannot accept that, therefore, I cannot use serde_test for testing.
The only workaround I can think of, is to make serde_test an optional dependency of serde, and for serde to re-export it when this optional dependency is enabled. This way, I can optionally depend on serde, without any features, and I can add a cargo feature to my crate that is enabled only for testing, and that enabled the serde_test feature of serde. This would allow me to pull in serde_test optionally only when testing, allowing my application to only link against the standard library there, and not unconditionally (as it would be caused by an unconditional dev-dependency to serde_test).
The text was updated successfully, but these errors were encountered:
Currently serde_test is designed to depend on serde so serde can't also depend on serde_test. I would recommend giving your crate an optional ordinary dependency on serde_test and following up with Cargo to improve the flexibility on their end.
Because
dev-dependencies
are not allowed to be optional (cc @ehuss), I have to makeserde_test
an unconditionaldev-dependency
, which means that it will always be part of the dependency graph of my crate when building it, and becauseserde_test
requiresstd
, this means that building my crate ends up always linking against the standard library.My crate is a
#[no_std]
crate, so I cannot accept that, therefore, I cannot useserde_test
for testing.The only workaround I can think of, is to make
serde_test
an optional dependency ofserde
, and forserde
to re-export it when this optional dependency is enabled. This way, I can optionally depend on serde, without any features, and I can add a cargo feature to my crate that is enabled only for testing, and that enabled theserde_test
feature ofserde
. This would allow me to pull inserde_test
optionally only when testing, allowing my application to only link against the standard library there, and not unconditionally (as it would be caused by an unconditional dev-dependency toserde_test
).The text was updated successfully, but these errors were encountered: