Skip to content

Commit 0b8d3b1

Browse files
authored
Rollup merge of rust-lang#90398 - GuillaumeGomez:doc-keyword-doc, r=camelid
Document `doc(keyword)` unstable attribute r? `@camelid`
2 parents 3730485 + 7bea8ea commit 0b8d3b1

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

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

+20-2
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,27 @@ Book][unstable-masked] and [its tracking issue][issue-masked].
134134

135135
## Document primitives
136136

137+
This is for Rust compiler internal use only.
138+
137139
Since primitive types are defined in the compiler, there's no place to attach documentation
138-
attributes. The `#[doc(primitive)]` attribute is used by the standard library to provide a way to generate
139-
documentation for primitive types, and requires `#![feature(doc_primitive)]` to enable.
140+
attributes. The `#[doc(primitive)]` attribute is used by the standard library to provide a way
141+
to generate documentation for primitive types, and requires `#![feature(doc_primitive)]` to enable.
142+
143+
## Document keywords
144+
145+
This is for Rust compiler internal use only.
146+
147+
Rust keywords are documented in the standard library (look for `match` for example).
148+
149+
To do so, the `#[doc(keyword = "...")]` attribute is used. Example:
150+
151+
```rust
152+
#![feature(doc_keyword)]
153+
154+
/// Some documentation about the keyword.
155+
#[doc(keyword = "keyword")]
156+
mod empty_mod {}
157+
```
140158

141159
## Unstable command-line arguments
142160

0 commit comments

Comments
 (0)