-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.P-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language team
Description
RFC: rust-lang/rfcs#560
Final text: https://github.com/rust-lang/rfcs/blob/master/text/0560-integer-overflow.md
List of tasks to accomplish:
- Optional error checking on
+,-,*Implement arithmetic overflow changes #22532 - Implement
wrapping_add,wrapping_sub,wrapping_mulfrom theWrappingOpstrait Implement arithmetic overflow changes #22532 - Optional error checking on
/,%(we currently check unconditionally; see signed division has undefined behaviour on overflow #8460) - Implement
wrapping_div,wrapping_remfrom theWrappingOpstrait (see arith-oflo: what is semantics of divideint::MIN.wrapped_div(-1)rfcs#964) Fill in missing parts of Integer overflow API #24420 - Optional error checking on
<<and>>overflowing-checking for rhs of shift operators #23536 - Implement
wrapping_lshift,wrapping_rshiftfrom theWrappingOpstrait- (renamed to
wrapping_shl,wrapping_shr.) Fill in missing parts of Integer overflow API #24420
- (renamed to
- Optional error checking on unary
-for signed values Check for overflow in arithmetic negation #24500 - Implement
wrapping_negfrom theWrappingOpstrait Fill in missing parts of Integer overflow API #24420 - Lint for use of one of the potentially fallible operations in an
unsafefn or fn containingunsafeblocks- Note that the use need not occur in an
unsafeblock, just a fn containingunsafeblocks
- Note that the use need not occur in an
- Option to forcibly enable overflow checking
- Overflow checking disabled by default when optimizations are enabled - rustc: Add a debug_assertions #[cfg] directive #22980
- Fix const_eval to do overflow checking based on declared type rather than
u64/i64(on all of the above cases) - arithmetic-overflow checks during const-eval #23863 (constant evaluation should not mask overflow for cases that are otherwise checked #22531)
-
Optional error checking onas(see http://internals.rust-lang.org/t/on-casts-and-checked-overflow/1710/15) -
Implementwrapping_as_Xmethods from theWrappingOpstrait- (above two are no longer needed since
ashas been [re]defined to never panic).
- (above two are no longer needed since
- consider saturating cast operations Add a saturating_cast between integers #23596
Metadata
Metadata
Assignees
Labels
B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.P-mediumMedium priorityMedium priorityT-langRelevant to the language teamRelevant to the language team