rust-lang / rust-lang/rust-by-example
Page on "New Type Idiom" don't mention need of using repr(transparent)
Nobody has claimed this yet.
- Dominant language
- Handlebars
- Stars
- 8.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Page that describes New Type Idiom https://doc.rust-lang.org/stable/rust-by-example/generics/new_types.html
Doesn't have any mention of #[repr(transparent)], and AFAIK it would be required for it to be zero cost abstraction and don't affect how it is passed in parameters (being passed in registers instead as a pointer to struct or whatever).
P.S. even documentation on repr transparent feature has newtype as example of intended usage
https://doc.rust-lang.org/1.26.2/unstable-book/language-features/repr-transparent.html
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 New Type Idiom page at doc.rust-lang.org/stable/rust-by-example/generics/new_types.html and compare it with the linked repr(transparent) documentation. Update the page to explain the relevant repr(transparent) consideration for newtypes, then verify that the wording accurately describes the intended zero-cost and parameter-passing behavior.
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
- Mostly clear
- Newbie friendliness
- 52/100