You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cargo features must be additive, because if two crates agree on the version of a common dependency, but want different features from it, that dependency is built only once, with the union of the features requested. So if a crate can meet a dependent's expectations with a given set of features enabled, it must still meet those expectations if additional features are enabled.
This is a pretty fundamental restriction on how you can use features, but the Cargo book doesn't mention it in the section on features. It would be a natural fit in the 'Rules' section.
The text was updated successfully, but these errors were encountered:
jimblandy
changed the title
Cargo book should explain why features must be additive
Cargo book should explain that features must be additive
Jul 6, 2020
Cargo features must be additive, because if two crates agree on the version of a common dependency, but want different features from it, that dependency is built only once, with the union of the features requested. So if a crate can meet a dependent's expectations with a given set of features enabled, it must still meet those expectations if additional features are enabled.
This is a pretty fundamental restriction on how you can use features, but the Cargo book doesn't mention it in the section on features. It would be a natural fit in the 'Rules' section.
The text was updated successfully, but these errors were encountered: