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
Copy file name to clipboardExpand all lines: src/doc/rustdoc/src/unstable-features.md
+21-21Lines changed: 21 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -720,9 +720,9 @@ pass `--doctest-build-arg ARG` for each argument `ARG`.
720
720
721
721
This flag enables the generation of toggles to expand macros in the HTML source code pages.
722
722
723
-
## `#[doc(cfg)]`
723
+
## `#[doc(cfg)]` and `#[doc(auto_cfg)]`
724
724
725
-
This feature aims at providing rustdoc users the possibility to add visual markers to the rendered documentation to know under which conditions an item is available (currently possible through the following unstable features: `doc_cfg`, `doc_auto_cfg` and `doc_cfg_hide`).
725
+
This feature aims at providing rustdoc users the possibility to add visual markers to the rendered documentation to know under which conditions an item is available (currently possible through the following unstable feature: `doc_cfg`).
726
726
727
727
It does not aim to allow having a same item with different `cfg`s to appear more than once in the generated documentation.
728
728
@@ -736,25 +736,6 @@ This features adds the following attributes:
736
736
737
737
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 `auto_cfg(hide(...))` and `auto_cfg(show(...))` are provided: they allow a child item to override its parent.
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.
742
-
743
-
This attribute impacts the item on which it is used and its descendants.
744
-
745
-
So if we take back the previous example:
746
-
747
-
```rust
748
-
#[cfg(feature ="futures-io")]
749
-
pubmodfutures {}
750
-
```
751
-
752
-
There's no need to "duplicate" the `cfg` into a `doc(cfg())` to make Rustdoc display it.
753
-
754
-
In some situations, the detailed conditional compilation rules used to implement the feature might not serve as good documentation (for example, the list of supported platforms might be very long, and it might be better to document them in one place). To turn it off, add the `#[doc(auto_cfg = false)]` attribute on the item.
755
-
756
-
If no argument is specified (ie `#[doc(auto_cfg)]`), it's the same as writing `#[doc(auto_cfg = true)]`.
757
-
758
739
### `#[doc(cfg(...))]`
759
740
760
741
This attribute provides a standardized format to override `#[cfg()]` attributes to document conditionally available items. Example:
@@ -927,6 +908,25 @@ Using this attribute will re-enable `auto_cfg` if it was disabled at this locati
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.
914
+
915
+
This attribute impacts the item on which it is used and its descendants.
916
+
917
+
So if we take back the previous example:
918
+
919
+
```rust
920
+
#[cfg(feature ="futures-io")]
921
+
pubmodfutures {}
922
+
```
923
+
924
+
There's no need to "duplicate" the `cfg` into a `doc(cfg())` to make Rustdoc display it.
925
+
926
+
In some situations, the detailed conditional compilation rules used to implement the feature might not serve as good documentation (for example, the list of supported platforms might be very long, and it might be better to document them in one place). To turn it off, add the `#[doc(auto_cfg = false)]` attribute on the item.
927
+
928
+
If no argument is specified (ie `#[doc(auto_cfg)]`), it's the same as writing `#[doc(auto_cfg = true)]`.
929
+
930
930
## Inheritance
931
931
932
932
Rustdoc merges `cfg` attributes from parent modules to its children. For example, in this case, the module `non_unix` will describe the entire compatibility matrix for the module, and not just its directly attached information:
0 commit comments