u64::saturating_div is useless
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
pub const fn saturating_div(self, rhs: u64) -> u64
This function will panic if rhs is 0.
This makes no sense. The only way that u64 / u64 could overfllow is if rhs = 0.
The same is true for the other unsigned integer types. The signed types have the excuse that they wouldn't know whether to count division by zero as saturating to -ve or +ve maximum.
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 by locating the u64::saturating_div implementation and the corresponding APIs for the other unsigned integer types. Review their documented division-by-zero behavior and the issue discussion; done requires a maintainer-approved resolution for how these APIs should behave.
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
- 30/100