Skip to content

Commit a295af1

Browse files
Clarify how doc(auto_cfg(hide()) works
1 parent 8187fe0 commit a295af1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

text/000-rustdoc-cfgs-handling.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ But you cannot write:
147147
#[doc(auto_cfg(hide(not(unix))))]
148148
```
149149

150+
So if we use `doc(auto_cfg(hide(unix)))`, it means it will hide all mentions of `unix`:
151+
152+
```rust
153+
#[cfg(unix)] // nothing displayed
154+
#[cfg(any(unix))] // nothing displayed
155+
#[cfg(any(unix, windows))] // only `windows` displayed
156+
```
157+
158+
However, it only impacts the `unix` cfg, not the feature:
159+
160+
```rust
161+
#[cfg(feature = "unix")] // `feature = "unix"` is displayed
162+
```
163+
150164
If `cfg_auto(show(...))` and `cfg_auto(hide(...))` are used to show/hide a same `cfg` on a same item, it'll emit an error. Example:
151165

152166
```rust

0 commit comments

Comments
 (0)