Skip to content

Commit 685ca70

Browse files
Merge pull request #233 from JohnTitor/alloc-removal
Follow-up for rust-lang/rust#74850
2 parents bfe1ab9 + be0687a commit 685ca70

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/vec-final.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ use std::mem;
1010
use std::ops::{Deref, DerefMut};
1111
use std::marker::PhantomData;
1212
use std::alloc::{
13-
AllocInit,
1413
AllocRef,
1514
Global,
1615
GlobalAlloc,
1716
Layout,
18-
ReallocPlacement,
1917
handle_alloc_error
2018
};
2119

@@ -42,16 +40,14 @@ impl<T> RawVec<T> {
4240
assert!(elem_size != 0, "capacity overflow");
4341

4442
let (new_cap, ptr) = if self.cap == 0 {
45-
let ptr = Global.alloc(Layout::array::<T>(1).unwrap(), AllocInit::Uninitialized);
43+
let ptr = Global.alloc(Layout::array::<T>(1).unwrap());
4644
(1, ptr)
4745
} else {
4846
let new_cap = 2 * self.cap;
4947
let c: NonNull<T> = self.ptr.into();
5048
let ptr = Global.grow(c.cast(),
5149
Layout::array::<T>(self.cap).unwrap(),
52-
Layout::array::<T>(new_cap).unwrap().size(),
53-
ReallocPlacement::MayMove,
54-
AllocInit::Uninitialized);
50+
Layout::array::<T>(new_cap).unwrap().size());
5551
(new_cap, ptr)
5652
};
5753

0 commit comments

Comments
 (0)