|
| 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. |
0 commit comments