diff options
| author | jonastepe <jonasprogrammer@gmail.com> | 2016-01-06 12:13:47 +0100 |
|---|---|---|
| committer | jonastepe <jonasprogrammer@gmail.com> | 2016-01-06 12:13:47 +0100 |
| commit | eb30c661c0f35e44c456e50c2655a4fcdb323f66 (patch) | |
| tree | a47e3bbdb8601a0c15ba331d36e67f3868cf94f8 | |
| parent | dc1f442634c2e37a8b80d59e27edcc24b5614d4e (diff) | |
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.
| -rw-r--r-- | src/doc/nomicon/vec-dealloc.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/doc/nomicon/vec-dealloc.md b/src/doc/nomicon/vec-dealloc.md index b767caa4912..706fe680e00 100644 --- a/src/doc/nomicon/vec-dealloc.md +++ b/src/doc/nomicon/vec-dealloc.md @@ -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); } } } |
