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
@@ -736,9 +736,9 @@ will be split as follows:
736
736
737
737
This flag enables the generation of toggles to expand macros in the HTML source code pages.
738
738
739
-
## `#[doc(cfg)]`
739
+
## `#[doc(cfg)]` and `#[doc(auto_cfg)]`
740
740
741
-
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`).
741
+
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`).
742
742
743
743
It does not aim to allow having a same item with different `cfg`s to appear more than once in the generated documentation.
744
744
@@ -752,25 +752,6 @@ This features adds the following attributes:
752
752
753
753
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.
758
-
759
-
This attribute impacts the item on which it is used and its descendants.
760
-
761
-
So if we take back the previous example:
762
-
763
-
```rust
764
-
#[cfg(feature ="futures-io")]
765
-
pubmodfutures {}
766
-
```
767
-
768
-
There's no need to "duplicate" the `cfg` into a `doc(cfg())` to make Rustdoc display it.
769
-
770
-
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.
771
-
772
-
If no argument is specified (ie `#[doc(auto_cfg)]`), it's the same as writing `#[doc(auto_cfg = true)]`.
773
-
774
755
### `#[doc(cfg(...))]`
775
756
776
757
This attribute provides a standardized format to override `#[cfg()]` attributes to document conditionally available items. Example:
@@ -943,6 +924,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.
930
+
931
+
This attribute impacts the item on which it is used and its descendants.
932
+
933
+
So if we take back the previous example:
934
+
935
+
```rust
936
+
#[cfg(feature ="futures-io")]
937
+
pubmodfutures {}
938
+
```
939
+
940
+
There's no need to "duplicate" the `cfg` into a `doc(cfg())` to make Rustdoc display it.
941
+
942
+
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.
943
+
944
+
If no argument is specified (ie `#[doc(auto_cfg)]`), it's the same as writing `#[doc(auto_cfg = true)]`.
945
+
946
946
## Inheritance
947
947
948
948
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