cargo-hack
cargo-hack copied to clipboard
Provide a way to allow (or check) to fail a particular combination of features
usecases:
- https://github.com/rust-lang/regex/blob/d6bc7a4c3b58e1d618024aaededa722df32fa6e8/src/lib.rs#L613
- https://github.com/rust-lang/futures-rs/blob/3601bb76708ea4bcc14c3491237abc33b685ba0b/futures/src/lib.rs#L100
- https://doc.rust-lang.org/cargo/reference/features.html#mutually-exclusive-features
Another use case, roughly:
cfg_if! {
if #[cfg(feature = "unstable")] {
// do something unstable
} else if #[cfg(feature = "polyfill")] {
// do something polyfilled
} else {
compile_error!("requires the `unstable` or `polyfill` feature");
}
}
This is useful when the polyfill feature is a dependency. (Example: std::lazy and once_cell.)
Though this is achievable with
cargo hack check --feature-powerset --features unstable
cargo hack check --feature-powerset --features polyfill
Either this or #182 would be quite helpful.
As already said in #182, I would accept a PR to implement #182.
Closing in favor of #182.