-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
According to the documentation on features, a dependency can have its features specified with the features key (although this is not documented in the actual dependencies section doc). However, it looks like there's no way for a feature to modify the feature list of an existing dependency, only to enable an optional dependency.
If I have a dependency with a feature, and I want to expose that feature as a feature of my own package, I don't see any way to do this. I can't use two dependencies with separate feature lists because a feature cannot disable a dependency. And there's no syntax for a feature to modify the feature list of a dependency.
This seems potentially very problematic to me. Ultimately, I think it's a consequence of features being designed far too heavily as merely toggles for optional dependencies. I think features need to have more control than just turning on optional dependencies. Yes, there's also a --cfg flag, but that doesn't help here either. In #385 I wrote two long comments with my thoughts on the feature design, which got no response. Admittedly it was pretty late in the process, but I still think it's important feedback. With the first feature syntax I suggested, there's plenty of room there to add extra power to features, such as the ability to disable dependencies, or to modify the feature list of a dependency. FWIW I think disabling dependencies might also be important, as I can imagine plenty of reasons why a library might want to have a feature to enable a rarely-used alternative implementation of something, which would need to disable any dependencies used by the disabled default implementation.