std: Fix implementation of Alloc::alloc_one

This had an accidental `u8 as *mut T` where it was intended to have just a
normal pointer-to-pointer cast.

Closes #42827
This commit is contained in:
Alex Crichton
2017-06-25 11:33:47 -07:00
parent c9bb93576d
commit d24d408af3
2 changed files with 28 additions and 1 deletions

View File

@@ -873,7 +873,7 @@ pub unsafe trait Alloc {
{
let k = Layout::new::<T>();
if k.size() > 0 {
unsafe { self.alloc(k).map(|p|Unique::new(*p as *mut T)) }
unsafe { self.alloc(k).map(|p| Unique::new(p as *mut T)) }
} else {
Err(AllocErr::invalid_input("zero-sized type invalid for alloc_one"))
}