Skip to content
/ rust Public
forked from rust-lang/rust

Commit dd20225

Browse files
authored
Update rc.rs docs
`wrapped_add` is used, not `checked_add`
1 parent efcbb94 commit dd20225

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/alloc/src/rc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3536,7 +3536,7 @@ impl<T> Default for Weak<T> {
35363536
}
35373537
}
35383538

3539-
// NOTE: We checked_add here to deal with mem::forget safely. In particular
3539+
// NOTE: We wrapping_add here to deal with mem::forget safely. In particular
35403540
// if you mem::forget Rcs (or Weaks), the ref-count can overflow, and then
35413541
// you can free the allocation while outstanding Rcs (or Weaks) exist.
35423542
// We abort because this is such a degenerate scenario that we don't care about

0 commit comments

Comments
 (0)