@@ -580,7 +580,7 @@ pub unsafe fn secp256k1_context_destroy(ctx: *mut Context) {
580
580
///
581
581
/// A callback function to be called when an illegal argument is passed to
582
582
/// 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.
584
584
///
585
585
/// The philosophy is that these shouldn't be dealt with through a
586
586
/// 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
600
600
use core:: str;
601
601
let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
602
602
let msg = str:: from_utf8_unchecked ( msg_slice) ;
603
- panic ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
603
+ #[ cfg( feature = "std" ) ]
604
+ println ! ( "[libsecp256k1] illegal argument. {}" , msg) ;
604
605
}
605
606
606
607
/// **This function is an override for the C function, this is the an edited version of the original description:**
607
608
///
608
609
/// A callback function to be called when an internal consistency check
609
- /// fails. **This will cause a panic**.
610
+ /// fails.
610
611
///
611
612
/// This can only trigger in case of a hardware failure, miscompilation,
612
613
/// 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:
623
624
use core:: str;
624
625
let msg_slice = slice:: from_raw_parts ( message as * const u8 , strlen ( message) ) ;
625
626
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) ;
627
629
}
628
630
629
631
#[ cfg( not( rust_secp_no_symbol_renaming) ) ]
0 commit comments