Skip to content

Commit

Permalink
Explain how doc(cfg) and doc(auto_cfg) interacts
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Jan 12, 2025
1 parent 4746afc commit 8187fe0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions text/000-rustdoc-cfgs-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ It will be displayed exactly the same as the previous code.

This attribute has the same syntax as conditional compilation, but it only causes documentation to be added. This means `#[doc(cfg(not(windows)))]` will not cause your docs to be hidden on non-windows targets, even though `#[cfg(not(windows))]` does do that.

If `doc(auto_cfg)` is enabled on the item, `doc(cfg)` will override it anyway so in the two previous examples, even if the `doc(auto_cfg)` feature was enabled, it would still display the same thing.

This attribute works on modules and on items.

### `#[doc(auto_cfg(hide(...)))]`
Expand Down

0 comments on commit 8187fe0

Please sign in to comment.