WARNING: this feature SHOULD NOT be enabled by library crates

So what is idea of this comment in Cargo.toml :

[features]
...
asm = ["sha1-asm"] # WARNING: this feature SHOULD NOT be enabled by library crates

If struct like "library crate" that depends on sha1, and "application" that depedns on "library crate",
where should I enable this feature?
Or I should add feature to my "library crate" that "exports" this feature via my own feature in "library crate", so I can enable this feature in "application crate" for "library crate" and this enables "sha1/asm" feature?

The reasoning for this is detailed here:

Short version: the asm feature does not work on all platforms, and if a Cargo feature is enabled, it isn't possible for downstream crates to disable it.

Leaving the feature off in a library ensures it will be compatible with all platforms, and users of the library can always enable the feature themselves if they want to.

6 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.