You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When this is turned on, `#[cfg]` attributes are shown in documentation just like `#[doc(cfg)]` attributes are. By default, `auto_cfg` will be enabled.
34
+
When this is turned on (with `doc(auto_cfg = true)`, `#[cfg]` attributes are shown in documentation just like `#[doc(cfg)]` attributes are. By default, `auto_cfg` will be enabled.
35
35
36
36
*`#[doc(cfg(...))]`
37
37
@@ -48,15 +48,14 @@ This RFC proposes to add the following attributes:
All of these attributes can be added to a module or to the crate root, and they will be inherited by the child items unless another attribute overrides it (except that `doc(cfg)` cannot be added to the crate root). This is why "opposite" attributes like `cfg_hide` and `cfg_show` are provided: they allow a child item to override its parent.
52
-
51
+
All of these attributes can be added to a module or to the crate root, and they will be inherited by the child items unless another attribute overrides it. This is why "opposite" attributes like `cfg_hide` and `cfg_show` are provided: they allow a child item to override its parent.
This is a crate-level attribute. By default, `#[doc(auto_cfg)]` is enabled at the crate-level. When it's enabled, Rustdoc will automatically display `cfg(...)` compatibility information as-if the same `#[doc(cfg(...))]` had been specified.
62
61
@@ -89,11 +88,11 @@ It will display in the documentation for this module:
89
88
90
89
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.
91
90
92
-
This attribute works on modules and on items but cannot be used at the crate root level.
91
+
This attribute works on modules and on items.
93
92
94
93
### `#[doc(cfg_hide(...))]`
95
94
96
-
This attribute is used to prevent some `cfg` to be generated in the visual markers. It only applies to `#[doc(auto_cfg(enable))]`, not to `#[doc(cfg(...))]`. So in the previous example:
95
+
This attribute is used to prevent some `cfg` to be generated in the visual markers. It only applies to `#[doc(auto_cfg = true)]`, not to `#[doc(cfg(...))]`. So in the previous example:
97
96
98
97
```rust
99
98
#[cfg(any(unix, feature ="futures-io"))]
@@ -144,7 +143,7 @@ pub fn foo() {}
144
143
### `#[doc(cfg_show(...))]`
145
144
146
145
This attribute does the opposite of `#[doc(cfg_hide(...))]`: if you used `#[doc(cfg_hide(...))]` and want to revert its effect on an item and its descendants, you can use `#[doc(cfg_show(...))]`.
147
-
It only applies to `#[doc(auto_cfg(enable))]`, not to `#[doc(cfg(...))]`.
146
+
It only applies to `#[doc(auto_cfg = true)]`, not to `#[doc(cfg(...))]`.
148
147
149
148
For example:
150
149
@@ -269,7 +268,7 @@ When re-exporting items with different cfgs there are two things that can happen
269
268
# Future possibilities
270
269
[future possibilities]: #future-possibilities
271
270
272
-
The `#[cfg(cfg_auto(enable))]`/`#[cfg(cfg_auto(disable))]` attribute is crate-level only for now as it doesn't really seem useful to be used on a specific item at the moment. However, if needed, this restriction could be lifted in the future if new needs come to appear.
271
+
The `#[cfg(cfg_auto = true)]`/`#[cfg(cfg_auto = false)]` attribute is crate-level only for now as it doesn't really seem useful to be used on a specific item at the moment. However, if needed, this restriction could be lifted in the future if new needs come to appear.
0 commit comments