]> git.lizzy.rs Git - rust.git/commitdiff
Move core::alloc::CollectionAllocErr to alloc::collections
authorSimon Sapin <simon.sapin@exyr.org>
Fri, 15 Jun 2018 01:56:35 +0000 (03:56 +0200)
committerSimon Sapin <simon.sapin@exyr.org>
Fri, 29 Jun 2018 12:01:33 +0000 (14:01 +0200)
src/liballoc/collections/mod.rs
src/liballoc/collections/vec_deque.rs
src/liballoc/raw_vec.rs
src/liballoc/string.rs
src/liballoc/vec.rs
src/libcore/alloc.rs
src/libstd/collections/hash/map.rs
src/libstd/collections/hash/table.rs
src/libstd/collections/mod.rs

index 35c816a1ceb6ed22407705eefb0be8b8b7fa4ea6..96e0eb633b2f54cbaa38ad8c230a4c6f165ebc97 100644 (file)
@@ -51,6 +51,35 @@ pub mod btree_set {
 #[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> {
index 4753d36415c4866bd8d231d1374ef2a442c3a8a2..ba92b886138c02efbeec9b421154965da89e41e7 100644 (file)
@@ -30,7 +30,7 @@
 use core::hash::{Hash, Hasher};
 use core::cmp;
 
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
 use raw_vec::RawVec;
 use vec::Vec;
 
index 5095bbe96cc670562ab39f35ee398bd44b74ba6e..4f2686abf4515fbb11554df4b81dd83114b51976 100644 (file)
@@ -18,8 +18,8 @@
 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
index a988b6a26d9df9e2038c6425581ad38d45c29db5..6b28687a060de58c059cdaa376192f8d0e0a0f5b 100644 (file)
@@ -66,7 +66,7 @@
 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};
index 752a6c966d51a35bcd4de701b6055f640255d4f9..fbbaced540e70cace77f7c600b31da99a4c9ed90 100644 (file)
@@ -80,7 +80,7 @@
 use core::ptr::NonNull;
 use core::slice;
 
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
 use borrow::ToOwned;
 use borrow::Cow;
 use boxed::Box;
index 91447e01ad4fabb6932022f22a8bd7f01f83c46f..01221aecb6284651aee6a4bf9189b90ec5ca0281 100644 (file)
@@ -385,34 +385,6 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-/// 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.
 ///
index ee8c1dc81ad75f90ca54221dffa2f0ee593f3fb5..91912e5f2412ef75eb59c25abba89f0574174c00 100644 (file)
@@ -11,7 +11,7 @@
 use self::Entry::*;
 use self::VacantEntryState::*;
 
-use alloc::CollectionAllocErr;
+use collections::CollectionAllocErr;
 use cell::Cell;
 use borrow::Borrow;
 use cmp::max;
index d14b754ddb6614831466307656733a8ae5110b0a..2b319186a8db2ffdb9b997ccdc54140e319e861f 100644 (file)
@@ -8,7 +8,8 @@
 // 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};
index 643426c377b747aaf53036f5da78e7ac9e6af66d..8d2c82bc0aa848a9c8df2eb30b891e5ddb50fc5e 100644 (file)
 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;