Skip to content

Commit 1ed3e77

Browse files
Add doc about doc alias feature
1 parent 48ab422 commit 1ed3e77

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

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

+16
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,19 @@ This is an internal flag intended for the standard library and compiler that app
373373
`#[unstable]` attribute to any dependent crate that doesn't have another stability attribute. This
374374
allows `rustdoc` to be able to generate documentation for the compiler crates and the standard
375375
library, as an equivalent command-line argument is provided to `rustc` when building those crates.
376+
377+
### `doc_alias` feature
378+
379+
This feature allows you to add alias(es) to an item when using the `rustdoc` search through the
380+
`doc(alias)` attribute. Example:
381+
382+
```rust,no_run
383+
#![feature(doc_alias)]
384+
385+
#[doc(alias = "x")]
386+
#[doc(alias = "big")]
387+
pub struct BigX;
388+
```
389+
390+
Then, when looking for it through the `rustdoc` search, if you enter "x" or
391+
"big", search will show the `BigX` struct first.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# `doc_alias`
2+
3+
The tracking issue for this feature is: [#50146]
4+
5+
[#50146]: https://github.com/rust-lang/rust/issues/50146
6+
7+
------------------------
8+
9+
You can add alias(es) to an item when using the `rustdoc` search through the
10+
`doc(alias)` attribute. Example:
11+
12+
```rust,no_run
13+
#![feature(doc_alias)]
14+
15+
#[doc(alias = "x")]
16+
#[doc(alias = "big")]
17+
pub struct BigX;
18+
```
19+
20+
Then, when looking for it through the `rustdoc` search, if you enter "x" or
21+
"big", search will show the `BigX` struct first.
22+
23+
Note that this feature is currently hidden behind the `feature(doc_alias)` gate.

0 commit comments

Comments
 (0)