about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-02-01 20:09:41 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-02-01 20:09:41 +0100
commit7c3290822a12aee86f1d2ea392e4811cd203df64 (patch)
treece7b9a20d69850c418dd001d0c3f1928f8bf8a41
parent48c4272718bde21e2fcb1969234ff0b2bc7bb9da (diff)
downloadrust-7c3290822a12aee86f1d2ea392e4811cd203df64.tar.gz
rust-7c3290822a12aee86f1d2ea392e4811cd203df64.zip
Extend "Attributes" section in the `re-exports` page
-rw-r--r--src/doc/rustdoc/src/write-documentation/re-exports.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/doc/rustdoc/src/write-documentation/re-exports.md b/src/doc/rustdoc/src/write-documentation/re-exports.md
index 8ce059cc29c..34688545c74 100644
--- a/src/doc/rustdoc/src/write-documentation/re-exports.md
+++ b/src/doc/rustdoc/src/write-documentation/re-exports.md
@@ -170,3 +170,32 @@ There are a few attributes which are not inlined though:
 
 All other attributes are inherited when inlined, so that the documentation matches the behavior if
 the inlined item was directly defined at the spot where it's shown.
+
+These rules also apply if the item is inlined with a glob re-export:
+
+```rust,ignore (inline)
+mod private_mod {
+    /// First
+    #[cfg(a)]
+    pub struct InPrivate;
+}
+
+#[cfg(c)]
+pub use self::private_mod::*;
+```
+
+Otherwise, the attributes displayed will be from the re-exported item and the attributes on the
+re-export itself will be ignored:
+
+```rust,ignore (inline)
+mod private_mod {
+    /// First
+    #[cfg(a)]
+    pub struct InPrivate;
+}
+
+#[cfg(c)]
+pub use self::private_mod::InPrivate;
+```
+
+In the above case, `cfg(c)` will not be displayed in the docs.