docs.rs icon indicating copy to clipboard operation
docs.rs copied to clipboard

Support a denylist for `all-features` Cargo metadata key

Open Manishearth opened this issue 3 years ago • 2 comments

Docs.rs currently supports metadata of this format:

[package.metadata.docs.rs]
all-features = true

Sometimes crates have "private" features; which shouldn't be documented on docs.rs. It is possible to use doc(hidden) on these, but it would be preferable if docs were not broken for these features when they're actually desired.

It would be nice to be able to supply a denylist of features that do not get run with all-features. AIUI the code currently just passes --all-features in, so it would probably need to be tweaked to use cargo metadata to get the full feature list.

Manishearth avatar Apr 05 '22 17:04 Manishearth

Why does this need to be a new feature instead of just using features = ["..."]? It seems weird to have both a way to say "these exact features" and "all features except these exact exceptions".

jyn514 avatar Apr 05 '22 18:04 jyn514

@jyn514 Because features do get added often, especially on the scale of projects like ICU4X where we have a large number of crates. I think the intent of the key matters; "all-features" is "all features including ones added in the future", whereas an explicit list of features is "just these features".

For prior art, https://github.com/frewsxcv/cargo-all-features does support this kind of thing.

But yeah, I would understand if this is considered rather niche.

Manishearth avatar Apr 05 '22 18:04 Manishearth