rollup merge of #19308: thestinger/oom

Closes #19305
This commit is contained in:
Alex Crichton 2014-11-26 09:44:55 -08:00
commit 989d7a78bb

View file

@ -187,6 +187,7 @@ impl<T> Vec<T> {
let size = capacity.checked_mul(mem::size_of::<T>())
.expect("capacity overflow");
let ptr = unsafe { allocate(size, mem::min_align_of::<T>()) };
if ptr.is_null() { ::alloc::oom() }
Vec { ptr: ptr as *mut T, len: 0, cap: capacity }
}
}