impl<T> Drop for Box<T> {
fn drop(&mut self) {
unsafe {
- drop_in_place(*self.ptr);
- heap::deallocate((*self.ptr) as *mut u8,
+ drop_in_place(self.ptr.as_ptr());
+ heap::deallocate(self.ptr.as_ptr() as *mut u8,
mem::size_of::<T>(),
mem::align_of::<T>());
}
impl<T> Drop for Box<T> {
fn drop(&mut self) {
unsafe {
- drop_in_place(*self.ptr);
- heap::deallocate((*self.ptr) as *mut u8,
+ drop_in_place(self.ptr.as_ptr());
+ heap::deallocate(self.ptr.as_ptr() as *mut u8,
mem::size_of::<T>(),
mem::align_of::<T>());
}
unsafe {
// Hyper-optimized: deallocate the box's contents for it
// without `drop`ing the contents
- heap::deallocate((*self.my_box.ptr) as *mut u8,
+ heap::deallocate(self.my_box.ptr.as_ptr() as *mut u8,
mem::size_of::<T>(),
mem::align_of::<T>());
}
impl<T> Drop for Box<T> {
fn drop(&mut self) {
unsafe {
- drop_in_place(*self.ptr);
- heap::deallocate((*self.ptr) as *mut u8,
+ drop_in_place(self.ptr.as_ptr());
+ heap::deallocate(self.ptr.as_ptr() as *mut u8,
mem::size_of::<T>(),
mem::align_of::<T>());
}
// without `drop`ing the contents. Need to set the `box`
// field as `None` to prevent Rust from trying to Drop it.
let my_box = self.my_box.take().unwrap();
- heap::deallocate((*my_box.ptr) as *mut u8,
+ heap::deallocate(my_box.ptr.as_ptr() as *mut u8,
mem::size_of::<T>(),
mem::align_of::<T>());
mem::forget(my_box);