rust-lang / rust-lang/rust-by-example
is the safe division example safe?
Nobody has claimed this yet.
- Dominant language
- Handlebars
- Stars
- 8.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
This Rust newb was browsing the nice Rust By Example but was surprised to see the Safe Division example under Option. It only checks for /0, but what about -2^31/-1 ? I don’t know what rust does but you cannot represent the result in 32-bit signed int so it should check that too.
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
Locate the Safe Division example under the Option section and first check how Rust handles -2^31/-1 in the example's integer type. Confirm whether the example's claim of safe division is accurate, then update the example or its explanation so the overflow case is correctly handled or documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100