From 895897e967578c00d8ac44066c0f24079b092a3c Mon Sep 17 00:00:00 2001 From: kennytm Date: Sun, 8 Jul 2018 03:12:59 +0800 Subject: [PATCH] Fix test failure, `oom` has been renamed to `handle_alloc_error`. See rust-lang/rust#51543. --- src/vec-final.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vec-final.md b/src/vec-final.md index b9fd9428..1cb2aa4e 100644 --- a/src/vec-final.md +++ b/src/vec-final.md @@ -9,7 +9,7 @@ use std::ptr::{Unique, NonNull, self}; use std::mem; use std::ops::{Deref, DerefMut}; use std::marker::PhantomData; -use std::alloc::{Alloc, GlobalAlloc, Layout, Global, oom}; +use std::alloc::{Alloc, GlobalAlloc, Layout, Global, handle_alloc_error}; struct RawVec { ptr: Unique, @@ -45,9 +45,9 @@ impl RawVec { (new_cap, ptr) }; - // If allocate or reallocate fail, oom + // If allocate or reallocate fail, handle it if ptr.is_err() { - oom(Layout::from_size_align_unchecked( + handle_alloc_error(Layout::from_size_align_unchecked( new_cap * elem_size, mem::align_of::(), ))