about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-11-25 05:43:43 +0000
committerbors <bors@rust-lang.org>2015-11-25 05:43:43 +0000
commit8ed03c81d906f55754d892bb2f7fda7f38e2217e (patch)
tree13e010758e11aa83f6ee56571c125c7505423315 /src/liballoc
parent7fa2c6ca31ae7ad8beb35ed11493339684786a10 (diff)
parent529689f0dc7b877b7e47cee53d66af2e97664a4d (diff)
downloadrust-8ed03c81d906f55754d892bb2f7fda7f38e2217e.tar.gz
rust-8ed03c81d906f55754d892bb2f7fda7f38e2217e.zip
Auto merge of #30049 - Manishearth:rollup, r=Manishearth
- Successful merges: #30013, #30038, #30040
- Failed merges: #30030
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index dba9b71c61c..45a47ae075e 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -637,6 +637,11 @@ impl<T: ?Sized> Weak<T> {
                 return None
             }
 
+            // See comments in `Arc::clone` for why we do this (for `mem::forget`).
+            if n > MAX_REFCOUNT {
+                unsafe { abort(); }
+            }
+
             // Relaxed is valid for the same reason it is on Arc's Clone impl
             let old = inner.strong.compare_and_swap(n, n + 1, Relaxed);
             if old == n {