Skip to content

Commit 7c32908

Browse files
Extend "Attributes" section in the re-exports page
1 parent 48c4272 commit 7c32908

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

src/doc/rustdoc/src/write-documentation/re-exports.md

+29
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,32 @@ There are a few attributes which are not inlined though:
170170

171171
All other attributes are inherited when inlined, so that the documentation matches the behavior if
172172
the inlined item was directly defined at the spot where it's shown.
173+
174+
These rules also apply if the item is inlined with a glob re-export:
175+
176+
```rust,ignore (inline)
177+
mod private_mod {
178+
/// First
179+
#[cfg(a)]
180+
pub struct InPrivate;
181+
}
182+
183+
#[cfg(c)]
184+
pub use self::private_mod::*;
185+
```
186+
187+
Otherwise, the attributes displayed will be from the re-exported item and the attributes on the
188+
re-export itself will be ignored:
189+
190+
```rust,ignore (inline)
191+
mod private_mod {
192+
/// First
193+
#[cfg(a)]
194+
pub struct InPrivate;
195+
}
196+
197+
#[cfg(c)]
198+
pub use self::private_mod::InPrivate;
199+
```
200+
201+
In the above case, `cfg(c)` will not be displayed in the docs.

0 commit comments

Comments
 (0)