Move core::alloc::CollectionAllocErr to alloc::collections
This commit is contained in:
@@ -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 library’s default
|
||||
/// though the `#[global_allocator]` attributes.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user