-
Notifications
You must be signed in to change notification settings - Fork 36
Add a doc alias policy #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
01bdfef
Add a doc alias policy
joshtriplett 8715f19
Note that `const` and non-`const` versions of the same function are fine
joshtriplett 27898ab
Drop `delete` example; give example of `rmdir` instead
joshtriplett 339b3fe
Reorder examples
joshtriplett 29d77cd
Fix typo
joshtriplett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
doc alias policy | ||
================ | ||
|
||
Rust's documentation supports adding aliases to any declaration (such as a | ||
function, type, or constant), using the syntax `#[doc(alias = "name")]`. We | ||
want to use doc aliases to help people find what they're looking for, while | ||
keeping those aliases maintainable and high-value. This policy outlines the | ||
cases where we add doc aliases, and the cases where we omit those aliases. | ||
|
||
- We must have a reasonable expectation that people might search for the term | ||
in the documentation search. Rust's documentation provides a name search, not | ||
a full-text search; as such, we expect that people may search for plausible | ||
names, but that for more general documentation searches they'll turn to a web | ||
search engine. | ||
- Related: we don't expect that people are currently searching Rust | ||
documentation for language-specific names from arbitrary languages they're | ||
familiar with, and we don't want to add that as a new documentation search | ||
feature; please don't add aliases based on your favorite language. Those | ||
mappings should live in separate guides or references. We do expect that | ||
people might look for the Rust name of a function they reasonably expect to | ||
exist in Rust (e.g. a system function or a C library function), to try to | ||
figure out what Rust called that function. | ||
- The proposed alias must be a name we would plausibly have used for the | ||
declaration. For instance, `mkdir` for `create_dir`, or `rmdir` for | ||
`remove_dir`, or `popcnt` and `popcount` for `count_ones`, or `umask` for | ||
`mode`. This feeds into the reasonable expectation that someone might search | ||
for the name and expect to find it ("what did Rust call `mkdir`"). | ||
- There must be an obvious single target for the alias that is an *exact* | ||
analogue of the aliased name. We will not add the same alias to multiple | ||
declarations. (`const` and non-`const` versions of the same function are | ||
fine.) We will also not add an alias for a function that's only somewhat | ||
similar or related. | ||
- The alias must not conflict with the actual name of any existing declaration. | ||
- As a special case for stdarch, aliases from exact assembly instruction names | ||
to the corresponding intrinsic function are welcome, as long as they don't | ||
conflict with other names. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- [doc alias policy](./doc-alias-policy.md) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.