rust-lang / rust-lang/fls

Overflow from integer negation expressions

Open Beginner friendly
#633 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
reStructuredText
Stars
497
Forks
41
Avg merge
3h 52m
Merged PRs (30d)
4

Description

§6.5.4:18 (fls_CutpaCFCGHQs) includes:

If the result of the negation expression does not fit within the range of the operand type, then arithmetic overflow occurs.

There is an exception which needs to be documented here: arithmetic overflow doesn't occur in some cases where the operand includes a literal and the value of the expression would fit in the type (eg -128_u8 or -(128_u8)).

See rust-lang/reference#1188 for how this was addressed there.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read §6.5.4:18 and the linked rust-lang/reference#1188 discussion first. Update the negation-overflow documentation to cover literal operands such as -128_u8 and -(128_u8), and consider the wording complete when the exception and its examples are accurately stated.

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
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.