In Cargo.toml, is it possible to say that a dependency has a feature only if a feature of my own crate is enabled? Root issue: I have a case where I have a proc-macro crate, and I only want it to emit certain code if a feature in my main crate is turned on/off.
My code is in a workspace, and the main crate depends on the proc-macro crate, then re-exports it.
Or, would my only option be to not have the main crate depend on the proc-macro crate, and enforce that my users set the features on both crates
yes, make a feature in your crate, and then make it have a required "dependency/feature" instead of just a required "feature".
[dependencies] my_crate_feature = ["dep_name/dep_feature"]
That worked. Thank you!