-
Couldn't load subscription status.
- Fork 13.9k
Description
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 Attributes, removing undesired cfgs before passing them to further processing.
The current implementation of doc_hide_cfg can only remove cfgs 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 into doc_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 for cfgs inside any and all, if this is desired.
Cc #43781.