diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs index 0fd2fb4df0381..8840bd8b352fa 100644 --- a/library/alloc/src/vec/into_iter.rs +++ b/library/alloc/src/vec/into_iter.rs @@ -11,7 +11,9 @@ use core::iter::{ TrustedRandomAccessNoCoerce, }; use core::marker::PhantomData; -use core::mem::{ManuallyDrop, SizedTypeProperties}; +use core::mem::ManuallyDrop; +#[cfg(not(no_global_oom_handling))] +use core::mem::SizedTypeProperties; use core::num::NonZero; #[cfg(not(no_global_oom_handling))] use core::ops::Deref; @@ -128,6 +130,7 @@ impl IntoIter { } /// Forgets to Drop the remaining elements while still allowing the backing allocation to be freed. + #[cfg(not(no_global_oom_handling))] pub(crate) fn forget_remaining_elements(&mut self) { self.drain.forget_remaining(); } diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index d0e644944323a..c0b73ed5141bb 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -64,9 +64,7 @@ use core::marker::PhantomData; use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties}; use core::ops::{self, Index, IndexMut, Range, RangeBounds}; use core::ptr::{self, NonNull}; -#[cfg(not(no_global_oom_handling))] -use core::slice::DrainRaw; -use core::slice::{self, SliceIndex}; +use core::slice::{self, DrainRaw, SliceIndex}; use crate::alloc::{Allocator, Global}; use crate::borrow::{Cow, ToOwned};