Skip to content

Commit

Permalink
heap::deallocate expects a *mut u8 but here a *mut T is given. The fi…
Browse files Browse the repository at this point in the history
…nal 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.
  • Loading branch information
jonastepe committed Jan 6, 2016
1 parent dc1f442 commit eb30c66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/doc/nomicon/vec-dealloc.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<T> Drop for Vec<T> {
let elem_size = mem::size_of::<T>();
let num_bytes = elem_size * self.cap;
unsafe {
heap::deallocate(*self.ptr, num_bytes, align);
heap::deallocate(*self.ptr as *mut _, num_bytes, align);
}
}
}
Expand Down

0 comments on commit eb30c66

Please sign in to comment.