@@ -580,7 +580,7 @@ pub unsafe fn secp256k1_context_destroy(ctx: *mut Context) {
580580///
581581/// A callback function to be called when an illegal argument is passed to
582582/// an API call. It will only trigger for violations that are mentioned
583- /// explicitly in the header. **This will cause a panic**.
583+ /// explicitly in the header.
584584///
585585/// The philosophy is that these shouldn't be dealt with through a
586586/// specific return value, as calling code should not have branches to deal with
@@ -600,13 +600,14 @@ pub unsafe extern "C" fn rustsecp256k1_v0_4_0_default_illegal_callback_fn(messag
600600 use core:: str;
601601 let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
602602 let msg = str:: from_utf8_unchecked ( msg_slice) ;
603- panic ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
603+ #[ cfg( feature = "std" ) ]
604+ println ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
604605}
605606
606607/// **This function is an override for the C function, this is the an edited version of the original description:**
607608///
608609/// A callback function to be called when an internal consistency check
609- /// fails. **This will cause a panic**.
610+ /// fails.
610611///
611612/// This can only trigger in case of a hardware failure, miscompilation,
612613/// memory corruption, serious bug in the library, or other error would can
@@ -623,7 +624,8 @@ pub unsafe extern "C" fn rustsecp256k1_v0_4_0_default_error_callback_fn(message:
623624 use core:: str;
624625 let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
625626 let msg = str:: from_utf8_unchecked ( msg_slice) ;
626- panic ! ( "[libsecp256k1] internal consistency check failed {}" , msg) ;
627+ #[ cfg( feature = "std" ) ]
628+ println ! ( "[libsecp256k1] internal consistency check failed {}" , msg) ;
627629}
628630
629631#[ cfg( not( rust_secp_no_symbol_renaming) ) ]
0 commit comments