Skip to content

Commit 5a93e16

Browse files
authored
Merge pull request #25 from joshtriplett/doc-alias-policy
Add a doc alias policy
2 parents 538511b + 29d77cd commit 5a93e16

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

src/SUMMARY.md

+5
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

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 names 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, `mkdir` for `create_dir`, or `rmdir` for
25+
`remove_dir`, or `popcnt` and `popcount` for `count_ones`, or `umask` for
26+
`mode`. This feeds into the reasonable expectation that someone might search
27+
for the name 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. (`const` and non-`const` versions of the same function are
31+
fine.) We will also not add an alias for a function that's only somewhat
32+
similar or related.
33+
- The alias must not conflict with the actual name of any existing declaration.
34+
- As a special case for stdarch, aliases from exact assembly instruction names
35+
to the corresponding intrinsic function are welcome, as long as they don't
36+
conflict with other names.

src/documentation/summary.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- [doc alias policy](./doc-alias-policy.md)

0 commit comments

Comments
 (0)