about summary refs log tree commit diff
path: root/src/libstd/alloc.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-05-31 18:36:51 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-06-11 13:48:25 -0700
commit951bc28fd09f5fed793021c6be1645e034394491 (patch)
treec873a453750330eec8a9512623ac33caee5efa63 /src/libstd/alloc.rs
parente9fd063edb4f6783fbd91a82a0f61626dacf8dad (diff)
downloadrust-951bc28fd09f5fed793021c6be1645e034394491.tar.gz
rust-951bc28fd09f5fed793021c6be1645e034394491.zip
Stablize the alloc module without changing stability of its contents.
Diffstat (limited to 'src/libstd/alloc.rs')
-rw-r--r--src/libstd/alloc.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/libstd/alloc.rs b/src/libstd/alloc.rs
index 9126155a7c9..1a4869f87c9 100644
--- a/src/libstd/alloc.rs
+++ b/src/libstd/alloc.rs
@@ -10,17 +10,20 @@
 
 //! Memory allocation APIs
 
-#![unstable(issue = "32838", feature = "allocator_api")]
-
-#[doc(inline)] pub use alloc_crate::alloc::{Global, Layout, oom};
-#[doc(inline)] pub use alloc_crate::alloc::{alloc, alloc_zeroed, dealloc, realloc};
-#[doc(inline)] pub use alloc_system::System;
-#[doc(inline)] pub use core::alloc::*;
+#![stable(feature = "alloc_module", since = "1.28.0")]
 
 use core::sync::atomic::{AtomicPtr, Ordering};
 use core::{mem, ptr};
 use sys_common::util::dumb_print;
 
+#[stable(feature = "alloc_module", since = "1.28.0")]
+#[doc(inline)]
+pub use alloc_crate::alloc::*;
+
+#[unstable(feature = "allocator_api", issue = "32838")]
+#[doc(inline)]
+pub use alloc_system::System;
+
 static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut());
 
 /// Registers a custom OOM hook, replacing any that was previously registered.
@@ -34,6 +37,7 @@ static HOOK: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut());
 /// about the allocation that failed.
 ///
 /// The OOM hook is a global resource.
+#[unstable(feature = "allocator_api", issue = "32838")]
 pub fn set_oom_hook(hook: fn(Layout)) {
     HOOK.store(hook as *mut (), Ordering::SeqCst);
 }
@@ -43,6 +47,7 @@ pub fn set_oom_hook(hook: fn(Layout)) {
 /// *See also the function [`set_oom_hook`].*
 ///
 /// If no custom hook is registered, the default hook will be returned.
+#[unstable(feature = "allocator_api", issue = "32838")]
 pub fn take_oom_hook() -> fn(Layout) {
     let hook = HOOK.swap(ptr::null_mut(), Ordering::SeqCst);
     if hook.is_null() {
@@ -59,6 +64,7 @@ fn default_oom_hook(layout: Layout) {
 #[cfg(not(test))]
 #[doc(hidden)]
 #[lang = "oom"]
+#[unstable(feature = "allocator_api", issue = "32838")]
 pub extern fn rust_oom(layout: Layout) -> ! {
     let hook = HOOK.load(Ordering::SeqCst);
     let hook: fn(Layout) = if hook.is_null() {
@@ -73,6 +79,7 @@ pub extern fn rust_oom(layout: Layout) -> ! {
 #[cfg(not(test))]
 #[doc(hidden)]
 #[allow(unused_attributes)]
+#[unstable(feature = "allocator_api", issue = "32838")]
 pub mod __default_lib_allocator {
     use super::{System, Layout, GlobalAlloc};
     // for symbol names src/librustc/middle/allocator.rs