mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-17 10:36:39 +00:00
Update rc.rs docs
Update comment per review feedback
This commit is contained in:
parent
dd20225681
commit
6a4af821b0
@ -3536,11 +3536,11 @@ impl<T> Default for Weak<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: We wrapping_add here to deal with mem::forget safely. In particular
|
||||
// if you mem::forget Rcs (or Weaks), the ref-count can overflow, and then
|
||||
// you can free the allocation while outstanding Rcs (or Weaks) exist.
|
||||
// We abort because this is such a degenerate scenario that we don't care about
|
||||
// what happens -- no real program should ever experience this.
|
||||
// NOTE: If you mem::forget Rcs (or Weaks), drop is skipped and the ref-count
|
||||
// is not decremented, meaning the ref-count can overflow, and then you can
|
||||
// free the allocation while outstanding Rcs (or Weaks) exist, which would be
|
||||
// unsound. We abort because this is such a degenerate scenario that we don't
|
||||
// care about what happens -- no real program should ever experience this.
|
||||
//
|
||||
// This should have negligible overhead since you don't actually need to
|
||||
// clone these much in Rust thanks to ownership and move-semantics.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user