From 5060b9c061119415103f953999443fd5bba5e7d5 Mon Sep 17 00:00:00 2001 From: jonastepe Date: Wed, 6 Jan 2016 12:13:47 +0100 Subject: [PATCH] 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. --- vec-dealloc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vec-dealloc.md b/vec-dealloc.md index b767caa..706fe68 100644 --- a/vec-dealloc.md +++ b/vec-dealloc.md @@ -21,7 +21,7 @@ impl Drop for Vec { let elem_size = mem::size_of::(); let num_bytes = elem_size * self.cap; unsafe { - heap::deallocate(*self.ptr, num_bytes, align); + heap::deallocate(*self.ptr as *mut _, num_bytes, align); } } }