Skip to content

Commit eb30c66

Browse files
author
jonastepe
committed
heap::deallocate expects a *mut u8 but here a *mut T is given. The final code is correct, the example here would not compile without the cast. I used *mut _ instead of *mut u8 to be consistent with the final code.
1 parent dc1f442 commit eb30c66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/nomicon/vec-dealloc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl<T> Drop for Vec<T> {
2121
let elem_size = mem::size_of::<T>();
2222
let num_bytes = elem_size * self.cap;
2323
unsafe {
24-
heap::deallocate(*self.ptr, num_bytes, align);
24+
heap::deallocate(*self.ptr as *mut _, num_bytes, align);
2525
}
2626
}
2727
}

0 commit comments

Comments
 (0)