Feature flag in documentation


I'm leveraging the nightly to have feature badge in the documentation following these instructions: rust - How to get a feature requirement tag in the documentation generated by `cargo doc`? - Stack Overflow

It works well but for macros that are defined in different modules that are available only if a feature flag is activated.

Am I missing something? Or this is how macros work?

This may be a doc_auto_cfg bug (it's a WIP feature): you may need to annotate the #[macro_export]-ed macros with a more explicit #[doc(cfg(feature = "…"))] annotation (likely cfg_attr(…)-gated for your crate to compile on stable).

1 Like