Skip to content

Commit 0c3158b

Browse files
committed
core::arc - add an assert
1 parent fd536d9 commit 0c3158b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/libcore/arc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ impl methods<T: send> for exclusive<T> {
112112
unsafe fn with<U>(f: fn(sys::condition, x: &mut T) -> U) -> U {
113113
let ptr: ~arc_data<ex_data<T>> =
114114
unsafe::reinterpret_cast(self.data);
115+
assert ptr.count > 0;
115116
let r = {
116117
let rec: &ex_data<T> = &(*ptr).data;
117118
rec.lock.lock_cond(|c| f(c, &mut rec.data))

0 commit comments

Comments
 (0)