Skip to content

Commit 686c7e9

Browse files
Add some precisions for reexports
1 parent 08f47ce commit 686c7e9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

text/000-rustdoc-cfgs-handling.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ Example:
222222
pub mod desktop {
223223
#[doc(cfg(not(unix)))]
224224
pub mod non_unix {
225-
//
225+
// code
226226
}
227227
}
228228

@@ -237,6 +237,19 @@ In this example, `non_unix_desktop` will only display `cfg(target_os = "freeebsd
237237

238238
On the contrary, `inlined_non_unix_desktop` will have cfgs from both the re-export and the re-exported item.
239239

240+
So that also means that if a crate re-exports a foreign item, unless it has `#[doc(inline)]`, the `cfg` and `doc(cfg)` attributes will not be visible:
241+
242+
```rust
243+
// dep:
244+
#[cfg(feature = "a")]
245+
pub struct S;
246+
247+
// crate using dep:
248+
249+
// There will be no mention of `feature = "a"` in the documentation.
250+
pub use dep::S as Y;
251+
```
252+
240253
# Drawbacks
241254
[drawbacks]: #drawbacks
242255

0 commit comments

Comments
 (0)