+To fix this, we have to make sure that the type `&ArcInner` is not used after `data` is dropped.
+The following would work, for example:
+{% highlight rust %}
+unsafe fn drop_slow(&mut self) {
+ let ptr = self.ptr.as_ptr();
+
+ let layout = Layout::for_value(&*ptr);
+
+ // Destroy the data at this time, even though we may not free the box
+ // allocation itself (there may still be weak pointers lying around).
+ ptr::drop_in_place(&mut (*ptr).data);
+ // We must not use the type &(mut) ArcInner from now on, because that
+ // type is actually no longer valid.
+
+ if (*ptr).weak.fetch_sub(1, Release) == 1 {
+ atomic::fence(Acquire);
+ Heap.dealloc(ptr as *mut u8, layout)
+ }
+}
+{% endhighlight %}
+