@@ -455,7 +455,7 @@ impl From<AllocErr> for CollectionAllocErr {
455
455
/// * `Layout` queries and calculations in general must be correct. Callers of
456
456
/// this trait are allowed to rely on the contracts defined on each method,
457
457
/// and implementors must ensure such contracts remain true.
458
- #[ unstable ( feature = "allocator_api " , issue = "32838 " ) ]
458
+ #[ stable ( feature = "global_alloc " , since = "1.28.0 " ) ]
459
459
pub unsafe trait GlobalAlloc {
460
460
/// Allocate memory as described by the given `layout`.
461
461
///
@@ -487,6 +487,7 @@ pub unsafe trait GlobalAlloc {
487
487
/// Clients wishing to abort computation in response to an
488
488
/// allocation error are encouraged to call the [`oom`] function,
489
489
/// rather than directly invoking `panic!` or similar.
490
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
490
491
unsafe fn alloc ( & self , layout : Layout ) -> * mut u8 ;
491
492
492
493
/// Deallocate the block of memory at the given `ptr` pointer with the given `layout`.
@@ -501,6 +502,7 @@ pub unsafe trait GlobalAlloc {
501
502
///
502
503
/// * `layout` must be the same layout that was used
503
504
/// to allocated that block of memory,
505
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
504
506
unsafe fn dealloc ( & self , ptr : * mut u8 , layout : Layout ) ;
505
507
506
508
/// Behaves like `alloc`, but also ensures that the contents
@@ -520,6 +522,7 @@ pub unsafe trait GlobalAlloc {
520
522
/// Clients wishing to abort computation in response to an
521
523
/// allocation error are encouraged to call the [`oom`] function,
522
524
/// rather than directly invoking `panic!` or similar.
525
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
523
526
unsafe fn alloc_zeroed ( & self , layout : Layout ) -> * mut u8 {
524
527
let size = layout. size ( ) ;
525
528
let ptr = self . alloc ( layout) ;
@@ -577,6 +580,7 @@ pub unsafe trait GlobalAlloc {
577
580
/// Clients wishing to abort computation in response to a
578
581
/// reallocation error are encouraged to call the [`oom`] function,
579
582
/// rather than directly invoking `panic!` or similar.
583
+ #[ stable( feature = "global_alloc" , since = "1.28.0" ) ]
580
584
unsafe fn realloc ( & self , ptr : * mut u8 , layout : Layout , new_size : usize ) -> * mut u8 {
581
585
let new_layout = Layout :: from_size_align_unchecked ( new_size, layout. align ( ) ) ;
582
586
let new_ptr = self . alloc ( new_layout) ;
0 commit comments