@@ -5,7 +5,7 @@ pub mod lazy;
55
66pub use lazy:: { InstructionContext , MaybeAccount } ;
77
8- #[ cfg( not( feature = "std " ) ) ]
8+ #[ cfg( not( feature = "alloc " ) ) ]
99use core:: alloc:: { GlobalAlloc , Layout } ;
1010
1111#[ cfg( target_os = "solana" ) ]
@@ -459,8 +459,8 @@ macro_rules! default_panic_handler {
459459/// This macro sets up a default panic handler that logs the location (file, line and column) where
460460/// the panic occurred and then calls the syscall `abort()`.
461461///
462- /// This macro can only be used when all crates are `no_std` and the `"std "` feature is disabled.
463- #[ cfg( not( feature = "std " ) ) ]
462+ /// This macro can only be used when all crates are `no_std` and the `"alloc "` feature is disabled.
463+ #[ cfg( not( feature = "alloc " ) ) ]
464464#[ macro_export]
465465macro_rules! nostd_panic_handler {
466466 ( ) => {
@@ -525,12 +525,12 @@ macro_rules! default_allocator {
525525
526526/// A global allocator that does not allocate memory.
527527///
528- /// Using this macro with the `"std "` feature enabled will result in a compile error.
529- #[ cfg( feature = "std " ) ]
528+ /// Using this macro with the `"alloc "` feature enabled will result in a compile error.
529+ #[ cfg( feature = "alloc " ) ]
530530#[ macro_export]
531531macro_rules! no_allocator {
532532 ( ) => {
533- compile_error!( "Feature 'std ' cannot be enabled." ) ;
533+ compile_error!( "Feature 'alloc ' cannot be enabled." ) ;
534534 } ;
535535}
536536
@@ -542,8 +542,8 @@ macro_rules! no_allocator {
542542///
543543/// The program will panic if it tries to dynamically allocate memory.
544544///
545- /// This is used when the `"std "` feature is disabled.
546- #[ cfg( not( feature = "std " ) ) ]
545+ /// This is used when the `"alloc "` feature is disabled.
546+ #[ cfg( not( feature = "alloc " ) ) ]
547547#[ macro_export]
548548macro_rules! no_allocator {
549549 ( ) => {
@@ -653,13 +653,13 @@ mod alloc {
653653 }
654654}
655655
656- #[ cfg( not( feature = "std " ) ) ]
656+ #[ cfg( not( feature = "alloc " ) ) ]
657657/// An allocator that does not allocate memory.
658658#[ cfg_attr( feature = "copy" , derive( Copy ) ) ]
659659#[ derive( Clone , Debug ) ]
660660pub struct NoAllocator ;
661661
662- #[ cfg( not( feature = "std " ) ) ]
662+ #[ cfg( not( feature = "alloc " ) ) ]
663663unsafe impl GlobalAlloc for NoAllocator {
664664 #[ inline]
665665 unsafe fn alloc ( & self , _: Layout ) -> * mut u8 {
@@ -674,13 +674,13 @@ unsafe impl GlobalAlloc for NoAllocator {
674674
675675#[ cfg( all( test, not( target_os = "solana" ) ) ) ]
676676mod tests {
677- extern crate std ;
677+ extern crate alloc ;
678678
679- use core:: { alloc:: Layout , ptr:: copy_nonoverlapping} ;
680- use std:: {
679+ use alloc:: {
681680 alloc:: { alloc, dealloc} ,
682681 vec,
683682 } ;
683+ use core:: { alloc:: Layout , ptr:: copy_nonoverlapping} ;
684684
685685 use super :: * ;
686686
@@ -703,7 +703,7 @@ mod tests {
703703 unsafe {
704704 let ptr = alloc ( layout) ;
705705 if ptr. is_null ( ) {
706- std :: alloc:: handle_alloc_error ( layout) ;
706+ alloc :: alloc:: handle_alloc_error ( layout) ;
707707 }
708708 AlignedMemory { ptr, layout }
709709 }
0 commit comments