Move core::alloc::CollectionAllocErr to alloc::collections

This commit is contained in:
Simon Sapin
2018-06-15 03:56:35 +02:00
parent 121b57b87a
commit b0547cea0a
9 changed files with 38 additions and 36 deletions

View File

@@ -385,34 +385,6 @@ impl fmt::Display for CannotReallocInPlace {
}
}
/// 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 librarys default
/// though the `#[global_allocator]` attributes.
///