Need an explicit part for requirements which can not be checked by compiler in trait docs
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Location
Trait std::borrow::Borrow,
Summary
Many traits require something more just their associated functions and types. Like trait Send requires that type are safe to tranferred between threads, Eq requires this relation is an equivalent relation and Ord need to be consistent with PartialOrd.
These requirements share a common characteristic: they cannot be fully verified by the compiler through the implementations of their associated trait methods and types. Programmers must take additional effort to ensure correctness. Similar to how the Safety and Panic sections in function or method documentation specifically describe the requirements for a function or method to work correctly, I propose that trait documentation also include a dedicated "requirements" section to outline these aspects that cannot be fully verified by the compiler.
For example, trait Borrow requires that
Eq,OrdandHashmust be equivalent for borrowed and owned values
which can not be checked by compiler. However, these points were buried in the second-to-last paragraph of the document description and were not highlighted.
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
Start with the documentation for trait std::borrow::Borrow and compare its requirements with the existing Safety and Panic sections in function or method documentation. Determine how a dedicated trait requirements section would be defined and applied to the Borrow documentation, with the non-compiler-checkable equivalence requirements clearly represented as the completion criterion.
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
- Needs clarification
- Newbie friendliness
- 30/100