Change `NonNull::{as_ref, as_mut}` to take `self` rather than `&self` in a future edition
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
NonNull has two methods that take &self even though the type is Copy:
The raw pointer methods take self so it is surprising NonNull is different. Taking a reference is unnecessary here and the returned lifetime is unrelated to it.
If we ever get a good way to give methods edition-dependent signatures, this may be something worth considering. Inspired by @cuviper's comment at https://rust-lang.zulipchat.com/#narrow/channel/136281-t-opsem/topic/Completing.20our.20set.20of.20pointer-conversion.20methods/near/423274344
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 linked NonNull::as_ref and NonNull::as_mut documentation, then compare their signatures with the raw pointer methods mentioned in the issue. Investigate whether edition-dependent method signatures are supported; done requires a concrete, accepted path for changing these APIs in a future edition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100