about summary refs log tree commit diff
path: root/src/libcore/alloc.rs
diff options
context:
space:
mode:
authorAmanieu d'Antras <amanieu@gmail.com>2018-05-29 13:09:09 +0200
committerAmanieu d'Antras <amanieu@gmail.com>2018-06-01 17:24:03 +0100
commitc6bebf4554692c07ff96c8395f8aeddb09443708 (patch)
tree48f4a1a2c2df39bf895b4094d992e35e0d43bfb2 /src/libcore/alloc.rs
parentf91323129000b20a5e3590d03fb3775bf73d5082 (diff)
downloadrust-c6bebf4554692c07ff96c8395f8aeddb09443708.tar.gz
rust-c6bebf4554692c07ff96c8395f8aeddb09443708.zip
Simplify HashMap layout calculation by using Layout
Diffstat (limited to 'src/libcore/alloc.rs')
-rw-r--r--src/libcore/alloc.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index 674c4fb57c7..6172a98bca6 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -392,6 +392,14 @@ impl From<AllocErr> for CollectionAllocErr {
     }
 }
 
+#[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 to be the one backing `std::alloc::Global`
 /// though the `#[global_allocator]` attributes.
 pub unsafe trait GlobalAlloc {