Skip to content

Commit ce22f30

Browse files
committed
Make note of doc duplication with reexports
Fixes #16645
1 parent cf636c2 commit ce22f30

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/doc/trpl/documentation.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% Rust Documentation
1+
% Documentation
22

33
`rustdoc` is the built-in tool for generating documentation. It integrates
44
with the compiler to provide accurate hyperlinking between usage of types and
@@ -294,3 +294,26 @@ Documentation` on the first line).
294294
Like with a Rust crate, the `--test` argument will run the code
295295
examples to check they compile, and obeys any `--test-args` flags. The
296296
tests are named after the last `#` heading.
297+
298+
# Re-exports
299+
300+
Rustdoc will show the documentation for a publc re-export in both places:
301+
302+
```{rust,ignore}
303+
extern crate foo;
304+
305+
pub use foo::bar;
306+
```
307+
308+
This will create documentation for `bar` both inside the documentation for
309+
the crate `foo`, as well as the documentation for your crate. It will use
310+
the same documentation in both places.
311+
312+
This behavior can be supressed with `no_inline`:
313+
314+
```{rust,ignore}
315+
extern crate foo;
316+
317+
#[doc(no_inline)]
318+
pub use foo::bar;
319+
```

0 commit comments

Comments
 (0)