From be0687ab1df7475202175cc2760ca52be575c046 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 6 Aug 2020 04:58:51 +0900 Subject: [PATCH] Follow-up for rust-lang/rust#74850 --- src/vec-final.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/vec-final.md b/src/vec-final.md index 7ef1e3b..629295e 100644 --- a/src/vec-final.md +++ b/src/vec-final.md @@ -10,12 +10,10 @@ use std::mem; use std::ops::{Deref, DerefMut}; use std::marker::PhantomData; use std::alloc::{ - AllocInit, AllocRef, Global, GlobalAlloc, Layout, - ReallocPlacement, handle_alloc_error }; @@ -42,16 +40,14 @@ impl RawVec { assert!(elem_size != 0, "capacity overflow"); let (new_cap, ptr) = if self.cap == 0 { - let ptr = Global.alloc(Layout::array::(1).unwrap(), AllocInit::Uninitialized); + let ptr = Global.alloc(Layout::array::(1).unwrap()); (1, ptr) } else { let new_cap = 2 * self.cap; let c: NonNull = self.ptr.into(); let ptr = Global.grow(c.cast(), Layout::array::(self.cap).unwrap(), - Layout::array::(new_cap).unwrap().size(), - ReallocPlacement::MayMove, - AllocInit::Uninitialized); + Layout::array::(new_cap).unwrap().size()); (new_cap, ptr) };