From 03d4d5f80ed1d9e168869bdb244e4fef67b7d3d0 Mon Sep 17 00:00:00 2001 From: Nick Cameron Date: Mon, 20 Apr 2015 10:52:26 +1200 Subject: Fix a bunch of bugs * segfault due to not copying drop flag when coercing * fat pointer casts * segfault due to not checking drop flag properly * debuginfo for DST smart pointers * unreachable code in drop glue --- src/liballoc/rc.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 4e8a7e8bfc9..837cf590024 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -544,7 +544,8 @@ impl Drop for Rc { fn drop(&mut self) { unsafe { let ptr = *self._ptr; - if !(*(&ptr as *const _ as *const *const ())).is_null() { + if !(*(&ptr as *const _ as *const *const ())).is_null() && + ptr as usize != mem::POST_DROP_USIZE { self.dec_strong(); if self.strong() == 0 { // destroy the contained object @@ -1010,7 +1011,8 @@ impl Drop for Weak { fn drop(&mut self) { unsafe { let ptr = *self._ptr; - if !(*(&ptr as *const _ as *const *const ())).is_null() { + if !(*(&ptr as *const _ as *const *const ())).is_null() && + ptr as usize != mem::POST_DROP_USIZE { self.dec_weak(); // the weak count starts at 1, and will only go to zero if all // the strong pointers have disappeared. -- cgit 1.4.1-3-g733a5