#[doc(no_inline)]
pub use self::vec_deque::VecDeque;
+use alloc::{AllocErr, LayoutErr};
+
+/// Augments `AllocErr` with a CapacityOverflow variant.
+#[derive(Clone, PartialEq, Eq, Debug)]
+#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
+pub enum CollectionAllocErr {
+ /// Error due to the computed capacity exceeding the collection's maximum
+ /// (usually `isize::MAX` bytes).
+ CapacityOverflow,
+ /// Error due to the allocator (see the `AllocErr` type's docs).
+ AllocErr,
+}
+
+#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
+impl From<AllocErr> for CollectionAllocErr {
+ #[inline]
+ fn from(AllocErr: AllocErr) -> Self {
+ CollectionAllocErr::AllocErr
+ }
+}
+
+#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
+impl From<LayoutErr> for CollectionAllocErr {
+ #[inline]
+ fn from(_: LayoutErr) -> Self {
+ CollectionAllocErr::CapacityOverflow
+ }
+}
+
/// An intermediate trait for specialization of `Extend`.
#[doc(hidden)]
trait SpecExtend<I: IntoIterator> {
use core::hash::{Hash, Hasher};
use core::cmp;
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
use raw_vec::RawVec;
use vec::Vec;
use core::slice;
use alloc::{Alloc, Layout, Global, handle_alloc_error};
-use alloc::CollectionAllocErr;
-use alloc::CollectionAllocErr::*;
+use collections::CollectionAllocErr;
+use collections::CollectionAllocErr::*;
use boxed::Box;
/// A low-level utility for more ergonomically allocating, reallocating, and deallocating
use core::str::pattern::Pattern;
use core::str::lossy;
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
use borrow::{Cow, ToOwned};
use boxed::Box;
use str::{self, from_boxed_utf8_unchecked, FromStr, Utf8Error, Chars};
use core::ptr::NonNull;
use core::slice;
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
use borrow::ToOwned;
use borrow::Cow;
use boxed::Box;
}
}
-/// Augments `AllocErr` with a CapacityOverflow variant.
-// FIXME: should this be in libcore or liballoc?
-#[derive(Clone, PartialEq, Eq, Debug)]
-#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
-pub enum CollectionAllocErr {
- /// Error due to the computed capacity exceeding the collection's maximum
- /// (usually `isize::MAX` bytes).
- CapacityOverflow,
- /// Error due to the allocator (see the `AllocErr` type's docs).
- AllocErr,
-}
-
-#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
-impl From<AllocErr> for CollectionAllocErr {
- #[inline]
- fn from(AllocErr: AllocErr) -> Self {
- CollectionAllocErr::AllocErr
- }
-}
-
-#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
-impl From<LayoutErr> for CollectionAllocErr {
- #[inline]
- fn from(_: LayoutErr) -> Self {
- CollectionAllocErr::CapacityOverflow
- }
-}
-
/// A memory allocator that can be registered as the standard library’s default
/// though the `#[global_allocator]` attributes.
///
use self::Entry::*;
use self::VacantEntryState::*;
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
use cell::Cell;
use borrow::Borrow;
use cmp::max;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use alloc::{Global, Alloc, Layout, LayoutErr, CollectionAllocErr, handle_alloc_error};
+use alloc::{Global, Alloc, Layout, LayoutErr, handle_alloc_error};
+use collections::CollectionAllocErr;
use hash::{BuildHasher, Hash, Hasher};
use marker;
use mem::{size_of, needs_drop};
pub use self::hash_set::HashSet;
#[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
-pub use alloc::CollectionAllocErr;
+pub use alloc_crate::collections::CollectionAllocErr;
mod hash;