about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-05-30 20:46:59 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-06-11 13:47:27 -0700
commit8c30c5168694b8ee740dade3a0145eef8aba66c6 (patch)
treee097254988d37c738a9310b9590e1ac39615d383
parent3373204ac49ebdb7194020ea9c556ce87910f7b7 (diff)
downloadrust-8c30c5168694b8ee740dade3a0145eef8aba66c6.tar.gz
rust-8c30c5168694b8ee740dade3a0145eef8aba66c6.zip
Remove deprecated heap modules
The heap.rs file was already unused.
-rw-r--r--src/liballoc/heap.rs110
-rw-r--r--src/liballoc/lib.rs8
-rw-r--r--src/libcore/lib.rs7
-rw-r--r--src/libstd/collections/mod.rs2
-rw-r--r--src/libstd/error.rs2
-rw-r--r--src/libstd/lib.rs7
6 files changed, 2 insertions, 134 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs
deleted file mode 100644
index 5ea37ceeb2b..00000000000
--- a/src/liballoc/heap.rs
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![allow(deprecated)]
-
-pub use alloc::{Layout, AllocErr, CannotReallocInPlace};
-use core::alloc::Alloc as CoreAlloc;
-use core::ptr::NonNull;
-
-#[doc(hidden)]
-pub mod __core {
-    pub use core::*;
-}
-
-#[derive(Debug)]
-pub struct Excess(pub *mut u8, pub usize);
-
-/// Compatibility with older versions of #[global_allocator] during bootstrap
-pub unsafe trait Alloc {
-    unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr>;
-    unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout);
-    fn oom(&mut self, err: AllocErr) -> !;
-    fn usable_size(&self, layout: &Layout) -> (usize, usize);
-    unsafe fn realloc(&mut self,
-                      ptr: *mut u8,
-                      layout: Layout,
-                      new_layout: Layout) -> Result<*mut u8, AllocErr>;
-    unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<*mut u8, AllocErr>;
-    unsafe fn alloc_excess(&mut self, layout: Layout) -> Result<Excess, AllocErr>;
-    unsafe fn realloc_excess(&mut self,
-                             ptr: *mut u8,
-                             layout: Layout,
-                             new_layout: Layout) -> Result<Excess, AllocErr>;
-    unsafe fn grow_in_place(&mut self,
-                            ptr: *mut u8,
-                            layout: Layout,
-                            new_layout: Layout) -> Result<(), CannotReallocInPlace>;
-    unsafe fn shrink_in_place(&mut self,
-                              ptr: *mut u8,
-                              layout: Layout,
-                              new_layout: Layout) -> Result<(), CannotReallocInPlace>;
-}
-
-unsafe impl<T> Alloc for T where T: CoreAlloc {
-    unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
-        CoreAlloc::alloc(self, layout).map(|ptr| ptr.cast().as_ptr())
-    }
-
-    unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) {
-        let ptr = NonNull::new_unchecked(ptr);
-        CoreAlloc::dealloc(self, ptr, layout)
-    }
-
-    fn oom(&mut self, _: AllocErr) -> ! {
-        unsafe { ::core::intrinsics::abort() }
-    }
-
-    fn usable_size(&self, layout: &Layout) -> (usize, usize) {
-        CoreAlloc::usable_size(self, layout)
-    }
-
-    unsafe fn realloc(&mut self,
-                      ptr: *mut u8,
-                      layout: Layout,
-                      new_layout: Layout) -> Result<*mut u8, AllocErr> {
-        let ptr = NonNull::new_unchecked(ptr);
-        CoreAlloc::realloc(self, ptr, layout, new_layout.size()).map(|ptr| ptr.cast().as_ptr())
-    }
-
-    unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
-        CoreAlloc::alloc_zeroed(self, layout).map(|ptr| ptr.cast().as_ptr())
-    }
-
-    unsafe fn alloc_excess(&mut self, layout: Layout) -> Result<Excess, AllocErr> {
-        CoreAlloc::alloc_excess(self, layout)
-            .map(|e| Excess(e.0 .cast().as_ptr(), e.1))
-    }
-
-    unsafe fn realloc_excess(&mut self,
-                             ptr: *mut u8,
-                             layout: Layout,
-                             new_layout: Layout) -> Result<Excess, AllocErr> {
-        let ptr = NonNull::new_unchecked(ptr);
-        CoreAlloc::realloc_excess(self, ptr, layout, new_layout.size())
-            .map(|e| Excess(e.0 .cast().as_ptr(), e.1))
-    }
-
-    unsafe fn grow_in_place(&mut self,
-                            ptr: *mut u8,
-                            layout: Layout,
-                            new_layout: Layout) -> Result<(), CannotReallocInPlace> {
-        let ptr = NonNull::new_unchecked(ptr);
-        CoreAlloc::grow_in_place(self, ptr, layout, new_layout.size())
-    }
-
-    unsafe fn shrink_in_place(&mut self,
-                              ptr: *mut u8,
-                              layout: Layout,
-                              new_layout: Layout) -> Result<(), CannotReallocInPlace> {
-        let ptr = NonNull::new_unchecked(ptr);
-        CoreAlloc::shrink_in_place(self, ptr, layout, new_layout.size())
-    }
-}
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 242c7d2e70f..828461fe8d7 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -150,18 +150,10 @@ pub mod allocator {
 
 pub mod alloc;
 
-#[unstable(feature = "allocator_api", issue = "32838")]
-#[rustc_deprecated(since = "1.27.0", reason = "module renamed to `alloc`")]
-/// Use the `alloc` module instead.
-pub mod heap {
-    pub use alloc::*;
-}
-
 #[unstable(feature = "futures_api",
            reason = "futures in libcore are unstable",
            issue = "50547")]
 pub mod task;
-
 // Primitive types using the heaps above
 
 // Need to conditionally define the mod from `boxed.rs` to avoid
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index a2ee0033872..5ba77edee6e 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -215,13 +215,6 @@ pub mod task;
 #[allow(missing_docs)]
 pub mod alloc;
 
-#[unstable(feature = "allocator_api", issue = "32838")]
-#[rustc_deprecated(since = "1.27.0", reason = "module renamed to `alloc`")]
-/// Use the `alloc` module instead.
-pub mod heap {
-    pub use alloc::*;
-}
-
 // note: does not need to be public
 mod iter_private;
 mod nonzero;
diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs
index d8e79b97970..42113414183 100644
--- a/src/libstd/collections/mod.rs
+++ b/src/libstd/collections/mod.rs
@@ -438,7 +438,7 @@ pub use self::hash_map::HashMap;
 pub use self::hash_set::HashSet;
 
 #[unstable(feature = "try_reserve", reason = "new API", issue="48043")]
-pub use heap::CollectionAllocErr;
+pub use alloc::CollectionAllocErr;
 
 mod hash;
 
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 817eea5eaf1..3160485375f 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -23,13 +23,13 @@
 // coherence challenge (e.g., specialization, neg impls, etc) we can
 // reconsider what crate these items belong in.
 
+use alloc::{AllocErr, LayoutErr, CannotReallocInPlace};
 use any::TypeId;
 use borrow::Cow;
 use cell;
 use char;
 use core::array;
 use fmt::{self, Debug, Display};
-use heap::{AllocErr, LayoutErr, CannotReallocInPlace};
 use mem::transmute;
 use num;
 use str;
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 4bf52224ae6..3972763a051 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -499,13 +499,6 @@ pub mod process;
 pub mod sync;
 pub mod time;
 
-#[unstable(feature = "allocator_api", issue = "32838")]
-#[rustc_deprecated(since = "1.27.0", reason = "module renamed to `alloc`")]
-/// Use the `alloc` module instead.
-pub mod heap {
-    pub use alloc::*;
-}
-
 // Platform-abstraction modules
 #[macro_use]
 mod sys_common;