std::pin documentation should be clearer about the precise drop guarantee/requirement
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
The current version of the documentation on the std::pin "drop guarantee" has a lot of exposition about why the drop guarantee is needed. That's great, but it doesn't super directly and explicitly say what the drop guarantee actually is, only sort of implying it in the second paragraph as part of a sentence that also contains exposition. I think I can infer it, but I find this makes it a lot harder to be sure I'm actually providing the guarantee correctly as a user.
Could you please add a more direct callout to exactly what the requirement/guarantee is, in more precise language? For example, with a block quote callout like the following, assuming it is accurate:
If you create a
Pin<Ptr>wherePtr::Targetis notUnpin, you must ensure that the storage for the pointee (i.e. thePtr::Targetobject) will not be reused unless the pointee is first dropped.
This is phrased as a requirement on the creator rather than a guarantee for the pinned object because I find it easier to understand that way, but a guarantee-phrased version would also be helpful.
(I also think the rest of the documentation could use some work to be more precise about other requirements/guarantees. Perhaps they could all be collected into one section with precise succinct language instead of needing to read all of what feels like an RFC each time to find them.)
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
The relevant documentation is in library/core/src/pin.rs, around the drop guarantee section at lines 537-586. Read that section first, then revise it to state the precise requirement or guarantee directly and succinctly, while preserving the existing explanation. Done means the rendered std::pin documentation makes the storage-reuse and prior-drop requirement explicit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100