@@ -467,7 +467,7 @@ impl From<LayoutErr> for CollectionAllocErr {
467
467
/// * `Layout` queries and calculations in general must be correct. Callers of
468
468
/// this trait are allowed to rely on the contracts defined on each method,
469
469
/// and implementors must ensure such contracts remain true.
470
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
470
+ #[ stable ( feature = "global_alloc " , since = "1.28.0 " ) ]
471
471
pub unsafe trait GlobalAlloc {
472
472
/// Allocate memory as described by the given `layout`.
473
473
///
@@ -499,6 +499,7 @@ pub unsafe trait GlobalAlloc {
499
499
/// Clients wishing to abort computation in response to an
500
500
/// allocation error are encouraged to call the [`oom`] function,
501
501
/// rather than directly invoking `panic!` or similar.
502
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
502
503
unsafe fn alloc ( & self , layout : Layout ) -> * mut u8 ;
503
504
504
505
/// Deallocate the block of memory at the given `ptr` pointer with the given `layout`.
@@ -513,6 +514,7 @@ pub unsafe trait GlobalAlloc {
513
514
///
514
515
/// * `layout` must be the same layout that was used
515
516
/// to allocated that block of memory,
517
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
516
518
unsafe fn dealloc ( & self , ptr : * mut u8 , layout : Layout ) ;
517
519
518
520
/// Behaves like `alloc`, but also ensures that the contents
@@ -532,6 +534,7 @@ pub unsafe trait GlobalAlloc {
532
534
/// Clients wishing to abort computation in response to an
533
535
/// allocation error are encouraged to call the [`oom`] function,
534
536
/// rather than directly invoking `panic!` or similar.
537
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
535
538
unsafe fn alloc_zeroed ( & self , layout : Layout ) -> * mut u8 {
536
539
let size = layout. size ( ) ;
537
540
let ptr = self . alloc ( layout) ;
@@ -589,6 +592,7 @@ pub unsafe trait GlobalAlloc {
589
592
/// Clients wishing to abort computation in response to a
590
593
/// reallocation error are encouraged to call the [`oom`] function,
591
594
/// rather than directly invoking `panic!` or similar.
595
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
592
596
unsafe fn realloc ( & self , ptr : * mut u8 , layout : Layout , new_size : usize ) -> * mut u8 {
593
597
let new_layout = Layout :: from_size_align_unchecked ( new_size, layout. align ( ) ) ;
594
598
let new_ptr = self . alloc ( new_layout) ;
0 commit comments