about summary refs log tree commit diff
path: root/src/libcore/alloc.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2018-05-31 19:13:18 +0200
committerSimon Sapin <simon.sapin@exyr.org>2018-06-11 13:48:39 -0700
commitbbaff036e7acef9f5b6bfdcb6339bfc6fa7ecfcf (patch)
tree146be050091c1c56681de710ec2f2fa18805dfe8 /src/libcore/alloc.rs
parent77606f20c92518c16d68bf16c0a117af1e925524 (diff)
downloadrust-bbaff036e7acef9f5b6bfdcb6339bfc6fa7ecfcf.tar.gz
rust-bbaff036e7acef9f5b6bfdcb6339bfc6fa7ecfcf.zip
Stablize the GlobalAlloc trait
Fixes https://github.com/rust-lang/rust/issues/49668
Diffstat (limited to 'src/libcore/alloc.rs')
-rw-r--r--src/libcore/alloc.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index a65a06d0c89..9c324cdb4ed 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -467,7 +467,7 @@ impl From<LayoutErr> for CollectionAllocErr {
 /// * `Layout` queries and calculations in general must be correct. Callers of
 ///   this trait are allowed to rely on the contracts defined on each method,
 ///   and implementors must ensure such contracts remain true.
-#[unstable(feature = "allocator_api", issue = "32838")]
+#[stable(feature = "global_alloc", since = "1.28.0")]
 pub unsafe trait GlobalAlloc {
     /// Allocate memory as described by the given `layout`.
     ///
@@ -499,6 +499,7 @@ pub unsafe trait GlobalAlloc {
     /// Clients wishing to abort computation in response to an
     /// allocation error are encouraged to call the [`oom`] function,
     /// rather than directly invoking `panic!` or similar.
+    #[stable(feature = "global_alloc", since = "1.28.0")]
     unsafe fn alloc(&self, layout: Layout) -> *mut u8;
 
     /// Deallocate the block of memory at the given `ptr` pointer with the given `layout`.
@@ -513,6 +514,7 @@ pub unsafe trait GlobalAlloc {
     ///
     /// * `layout` must be the same layout that was used
     ///   to allocated that block of memory,
+    #[stable(feature = "global_alloc", since = "1.28.0")]
     unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);
 
     /// Behaves like `alloc`, but also ensures that the contents
@@ -532,6 +534,7 @@ pub unsafe trait GlobalAlloc {
     /// Clients wishing to abort computation in response to an
     /// allocation error are encouraged to call the [`oom`] function,
     /// rather than directly invoking `panic!` or similar.
+    #[stable(feature = "global_alloc", since = "1.28.0")]
     unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
         let size = layout.size();
         let ptr = self.alloc(layout);
@@ -589,6 +592,7 @@ pub unsafe trait GlobalAlloc {
     /// Clients wishing to abort computation in response to a
     /// reallocation error are encouraged to call the [`oom`] function,
     /// rather than directly invoking `panic!` or similar.
+    #[stable(feature = "global_alloc", since = "1.28.0")]
     unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
         let new_layout = Layout::from_size_align_unchecked(new_size, layout.align());
         let new_ptr = self.alloc(new_layout);