2525#[ cfg( any( test, feature = "std" ) ) ]
2626extern crate core;
2727
28+ #[ cfg( feature = "alloc" ) ]
29+ extern crate alloc;
30+
2831#[ cfg( fuzzing) ]
2932const THIS_UNUSED_CONSTANT_IS_YOUR_WARNING_THAT_ALL_THE_CRYPTO_IN_THIS_LIB_IS_DISABLED_FOR_FUZZING : usize = 0 ;
3033
@@ -540,11 +543,11 @@ extern "C" {
540543///
541544/// The newly created secp256k1 raw context.
542545#[ no_mangle]
543- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
544- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
546+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
547+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
545548pub unsafe extern "C" fn rustsecp256k1_v0_5_0_context_create ( flags : c_uint ) -> * mut Context {
546549 use core:: mem;
547- use std :: alloc;
550+ use crate :: alloc :: alloc;
548551 assert ! ( ALIGN_TO >= mem:: align_of:: <usize >( ) ) ;
549552 assert ! ( ALIGN_TO >= mem:: align_of:: <& usize >( ) ) ;
550553 assert ! ( ALIGN_TO >= mem:: size_of:: <usize >( ) ) ;
@@ -560,8 +563,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_5_0_context_create(flags: c_uint) -> *
560563 secp256k1_context_preallocated_create ( ptr, flags)
561564}
562565
563- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
564- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
566+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
567+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
565568pub unsafe fn secp256k1_context_create ( flags : c_uint ) -> * mut Context {
566569 rustsecp256k1_v0_5_0_context_create ( flags)
567570}
@@ -573,19 +576,19 @@ pub unsafe fn secp256k1_context_create(flags: c_uint) -> *mut Context {
573576/// The pointer shouldn't be used after passing to this function, consider it as passing it to `free()`.
574577///
575578#[ no_mangle]
576- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
577- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
579+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
580+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
578581pub unsafe extern "C" fn rustsecp256k1_v0_5_0_context_destroy ( ctx : * mut Context ) {
579- use std :: alloc;
582+ use crate :: alloc :: alloc;
580583 secp256k1_context_preallocated_destroy ( ctx) ;
581584 let ptr = ( ctx as * mut u8 ) . sub ( ALIGN_TO ) ;
582585 let bytes = ( ptr as * mut usize ) . read ( ) ;
583586 let layout = alloc:: Layout :: from_size_align ( bytes, ALIGN_TO ) . unwrap ( ) ;
584587 alloc:: dealloc ( ptr, layout) ;
585588}
586589
587- #[ cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ]
588- #[ cfg_attr( docsrs, doc( cfg( all( feature = "std " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
590+ #[ cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ]
591+ #[ cfg_attr( docsrs, doc( cfg( all( feature = "alloc " , not( rust_secp_no_symbol_renaming) ) ) ) ) ]
589592pub unsafe fn secp256k1_context_destroy ( ctx : * mut Context ) {
590593 rustsecp256k1_v0_5_0_context_destroy ( ctx)
591594}
0 commit comments