I have a use-case I’ve described here: https://github.com/rust-lang/cargo/issues/5653#issuecomment-430489303
The short version is that I’d like to see mutually exclusive feature flags to ensure that multiple versions of the same crate (via the cargo feature linked above) don’t conflict at link time. This can happen when dealing with ffi crates that link to an external library.
So I guess I was wondering, has this ever come up before? Does the idea seem reasonable? Would it be difficult for cargo to support this functionality?
Maybe it could look something like this in Cargo.toml (not sure if valid syntax):
[package] mutually_exclusive_features = [ ["x_feature", "y_feature"], ["y_feature", "z_feature"], ] [features] default =  x_feature =  y_feature =  z_feature = 
That way the only valid features are none, individual features, or “x_feature” && “z_feature”, enforced by cargo.