Skip to content

Commit 529689f

Browse files
committed
Rollup merge of #30040 - apasel422:issue-30031, r=brson
Closes #30031.
2 parents 3f25c5c + 0fc1f9a commit 529689f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/liballoc/arc.rs

+5
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,11 @@ impl<T: ?Sized> Weak<T> {
637637
return None
638638
}
639639

640+
// See comments in `Arc::clone` for why we do this (for `mem::forget`).
641+
if n > MAX_REFCOUNT {
642+
unsafe { abort(); }
643+
}
644+
640645
// Relaxed is valid for the same reason it is on Arc's Clone impl
641646
let old = inner.strong.compare_and_swap(n, n + 1, Relaxed);
642647
if old == n {

0 commit comments

Comments
 (0)