Skip to content

Commit

Permalink
Explicitly mention overflow is what we're checking
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbshaw authored Mar 23, 2022
1 parent 3c90789 commit 7fad6f1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions alloc/src/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2524,8 +2524,8 @@ trait RcInnerPtr {
self.strong_ref().set(strong);

// We want to abort on overflow instead of dropping the value.
// Checking after the store instead of before allows for
// slightly better code generation.
// Checking for overflow after the store instead of before
// allows for slightly better code generation.
if core::intrinsics::unlikely(strong == 0) {
abort();
}
Expand Down Expand Up @@ -2557,8 +2557,8 @@ trait RcInnerPtr {
self.weak_ref().set(weak);

// We want to abort on overflow instead of dropping the value.
// Checking after the store instead of before allows for
// slightly better code generation.
// Checking for overflow after the store instead of before
// allows for slightly better code generation.
if core::intrinsics::unlikely(weak == 0) {
abort();
}
Expand Down

0 comments on commit 7fad6f1

Please sign in to comment.