Remove cfg(test)
from doc_auto_cfg
#91740
Labels
A-rustdoc-ui
Area: Rustdoc UI (generated HTML)
F-doc_auto_cfg
`#![feature(doc_auto_cfg)]`
F-doc_cfg
`#![feature(doc_cfg)]`
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
From #43781 (comment) and #43781 (comment).
Currently
#[cfg(any(feature = "danger", test))]
shows up as:This seems to be undesired behavior. I'm not familiar with the Rust compiler, but looking through the code lead me to the conclusion that the best way to do this is transform
Attribute
s, removing undesiredcfg
s before passing them to further processing.The current implementation of
doc_hide_cfg
can only removecfg
s that have an exact match.#![doc(cfg_hide(feature = "x"))]
can only hide#[cfg(feature = "x")]
, it can't hide#[cfg(any(feature = "x", feature = "y"))]
or#[cfg(all(feature = "x", feature = "y"))]
. So my impression is that we can't hook intodoc_hide_cfg
to solve this.Implementing what I described above could also pave the way to adjust the behaviour of
cfg_hide
and allow it to match forcfg
s insideany
andall
, if this is desired.Cc #43781.
The text was updated successfully, but these errors were encountered: