Skip to content

Commit 9a3000f

Browse files
GuillaumeGomezRustyYato
authored andcommitted
Extend "Attributes" section in the re-exports page
1 parent f0baae8 commit 9a3000f

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

Lines changed: 29 additions & 0 deletions
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)