Skip to content

Make cfg imply doc(cfg)#79341

Closed
Nemo157 wants to merge 5 commits intorust-lang:masterfrom
Nemo157:implicit-doc-cfg
Closed

Make cfg imply doc(cfg)#79341
Nemo157 wants to merge 5 commits intorust-lang:masterfrom
Nemo157:implicit-doc-cfg

Conversation

@Nemo157
Copy link
Contributor

@Nemo157 Nemo157 commented Nov 23, 2020

This is only active when the doc_cfg feature is active.

The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to hide a #[cfg] you can use something like:

#[cfg(unix)]
#[doc(cfg(all()))]
pub struct Unix;

By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and only that exact cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.

TODO:

  • Test against some popular libraries, especially those already using doc(cfg)
  • Update doc(cfg) docs
  • Add doc(cfg_hide) docs

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-doc_cfg `#![feature(doc_cfg)]` S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.