Skip to content

Commit

Permalink
Extend "Attributes" section in the re-exports page
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 1, 2024
1 parent 48c4272 commit 7c32908
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/doc/rustdoc/src/write-documentation/re-exports.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 7c32908

Please sign in to comment.