Only include cargo.toml dependency on nightly?


#1

I’ve got a no-std project that has a dependency on lazy_static. Unfortunately, lazy_static can only be no-std on nightly right now. I’ve made it so that my code only uses it on nightly, but even though I don’t include it via extern crate lazy_static; on stable, I still get a compilation error because its inclusion as a Cargo.toml dependency causes it to be compiled. Is there a way that I can instruct cargo not to try to compile it if I’m not compiling on nightly?


#2

Many crates have a “nightly” feature to obtain this behavior.

See http://doc.crates.io/manifest.html#the-features-section


#3

Ah that works; thanks!