Closed loyd closed 2 years ago
I'm not sure adding the additional feature is worth the complexity, especially since you can use the doc_auto_cfg
nightly feature to have doc(cfg)
applied everywhere there is a cfg
gated item. I use this in some of my crates to get the cfg badges:
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
#![cfg_attr(feature = "nightly", feature(doc_auto_cfg))]
Then I enable the nightly
feature in Cargo.toml like so:
[package.metadata.docs.rs]
features = ["nightly"]
There's probably other ways of doing this as well without needing to modify the stability
macros.
doc_auto_cfg
is much better than modifying stability
. Thanks a lot)
It would be nice to add a badge
unstable
for items with#[stability::unstable]
:A common approach for this (e.g. used by
tokio
) is relying on thedoc_cfg
feature. Details. It works fine with the current docsrs.So,
#[stability::unstable]
can additionally generate#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
. However, it still requires#![cfg_attr(docsrs, feature(doc_cfg))]
at crate level andin Cargo.toml
The good news is that it doesn't fail even if these steps haven't added.
Will you accept the PR with an additional feature (
docsrs-cfg
?) that enables generation of#[cfg_attr(docsrs, doc(cfg(feature = "unstable")))]
?