rust-lang / rust-lang/reference
Guidelines for documenting the *why* of something
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- PR merge metrics
- PR metrics pending
Description
I think the authoring guide should have some guidelines for mentioning why something is the way it is.
In the Reference, we have generally avoided that, but I think that is a detriment to some readers, since just specifying the behavior of something can be extremely hard to understand why it matters, or how it is relevant to a Rust programmer.
That kind of information can provide useful and interesting context. However, documenting the motivation for every aspect of the language could easily overwhelm the content and be distracting.
Graydon spoke highly of the Ada rationale (the 1979 version specifically), using it while working on Rust.
A very minor example: The type_length_limit attributes explains what it does, but not why it is there. I think it could be useful to have a note like: type_length_limit is used to prevent the compiler from hanging and to better deal with polymorphic recursion.
Regardless, I think it would be good to have a policy, as contributors sometimes include this information that we then need to tell them to remove. Guidelines could bring clarity on what we expect.
See also this comment: https://github.com/rust-lang/spec/issues/27#issuecomment-1974734900
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the authoring guide and existing Reference conventions, then read the linked Ada rationale and the related comment in spec issue #27. Determine where guidance on documenting motivation belongs and what limits prevent excessive context. Done means the project has an agreed policy that contributors can follow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100