Skip to content

Commit 067553d

Browse files
talk about doc(include)
1 parent 82bd146 commit 067553d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/doc/rustdoc/src/unstable-features.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,25 @@ To prevent internal types from being included in documentation, the standard lib
162162
attribute to their `extern crate` declarations: `#[doc(masked)]`. This causes Rustdoc to "mask out"
163163
types from these crates when building lists of trait implementations.
164164

165-
The `#[doc(masked)]` attribute is intended to be used internally, and is governed by a feature gate.
166-
For more information, see [its chapter in the Unstable Book][unstable-masked] and [its tracking
167-
issue][issue-masked].
165+
The `#[doc(masked)]` attribute is intended to be used internally, and is controlled by a feature
166+
gate. For more information, see [its chapter in the Unstable Book][unstable-masked] and [its
167+
tracking issue][issue-masked].
168168

169169
[unstable-masked]: ../unstable-book/language-features/doc-masked.html
170170
[issue-masked]: https://github.com/rust-lang/rust/issues/44027
171+
172+
## Include external files as API documentation
173+
174+
As designed in [RFC 1990], Rustdoc can read an external file to use as a type's documentation. This
175+
is useful if certain documentation is so long that it would break the flow of reading the source.
176+
Instead of writing it all inline, writing `#[doc(include = "sometype.md")]` (where `sometype.md` is
177+
a file adjacent to the `lib.rs` for the crate) will ask Rustdoc to instead read that file and use it
178+
as if it were written inline.
179+
180+
[RFC 1990]: https://github.com/rust-lang/rfcs/pull/1990
181+
182+
`#[doc(include = "...")]` is currently controlled by a feature gate. For more information, see [its
183+
chapter in the Unstable Book][unstable-include] and [its tracking issue][issue-include].
184+
185+
[unstable-include]: ../unstable-book/language-features/external-doc.html
186+
[issue-include]: https://github.com/rust-lang/rust/issues/44732

0 commit comments

Comments
 (0)