Skip to content

Commit 01bdfef

Browse files
committed
Add a doc alias policy
Based on discussion in 2021-06-30 libs meeting.
1 parent 538511b commit 01bdfef

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

src/SUMMARY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636

3737
---
3838

39+
- [Documentation](./documentation/summary.md)
40+
- [doc alias policy](./documentation/doc-alias-policy.md)
41+
42+
---
43+
3944
- [Tools and bots](./tools-and-bots/summary.md)
4045
- [`@bors`](./tools-and-bots/bors.md)
4146
- [`@rust-timer`](./tools-and-bots/timer.md)

src/documentation/doc-alias-policy.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
doc alias policy
2+
================
3+
4+
Rust's documentation supports adding aliases to any declaration (such as a
5+
function, type, or constant), using the syntax `#[doc(alias = "name")]`. We
6+
want to use doc aliases to help people find what they're looking for, while
7+
keeping those aliases maintainable and high-value. This policy outlines the
8+
cases where we add doc aliases, and the cases where we omit those aliases.
9+
10+
- We must have a reasonable expectation that people might search for the term
11+
in the documentation search. Rust's documentation provides a name search, not
12+
a full-text search; as such, we expect that people may search for plausible
13+
names, but that for more general documentation searches they'll turn to a web
14+
search engine.
15+
- Related: we don't expect that people are currently searching Rust
16+
documentation for language-specific name from arbitrary languages they're
17+
familiar with, and we don't want to add that as a new documentation search
18+
feature; please don't add aliases based on your favorite language. Those
19+
mappings should live in separate guides or references. We do expect that
20+
people might look for the Rust name of a function they reasonably expect to
21+
exist in Rust (e.g. a system function or a C library function), to try to
22+
figure out what Rust called that function.
23+
- The proposed alias must be a name we would plausibly have used for the
24+
declaration. For instance, `delete` for `remove`, or `popcnt` and `popcount`
25+
for `count_ones`, or `umask` for `mode`, or `mkdir` for `create_dir`. This
26+
feeds into the reasonable expectation that someone might search for the name
27+
and expect to find it ("what did Rust call `mkdir`").
28+
- There must be an obvious single target for the alias that is an *exact*
29+
analogue of the aliased name. We will not add the same alias to multiple
30+
declarations. We will also not add an alias for a function that's only
31+
somewhat similar or related.
32+
- The alias must not conflict with the actual name of any existing declaration.
33+
- As a special case for stdarch, aliases from exact assembly instruction names
34+
to the corresponding intrinsic function are welcome, as long as they don't
35+
conflict with other names.

src/documentation/summary.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [doc alias policy](./doc-alias-policy.md)

0 commit comments

Comments
 (0)