diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-04-20 10:52:26 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-05-13 14:19:51 +1200 |
| commit | 03d4d5f80ed1d9e168869bdb244e4fef67b7d3d0 (patch) | |
| tree | d6fbc4384526bd7a96b39b708767558dc9b34f72 /src/liballoc | |
| parent | 7d953538d10c4a31300afd27f73563adb056beab (diff) | |
| download | rust-03d4d5f80ed1d9e168869bdb244e4fef67b7d3d0.tar.gz rust-03d4d5f80ed1d9e168869bdb244e4fef67b7d3d0.zip | |
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
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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<T: ?Sized> Drop for Rc<T> { 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<T: ?Sized> Drop for Weak<T> { 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. |
