#![deny(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![no_std]
#[cfg(feature = "std")]
extern crate std;
extern crate alloc;
use core::panic::PanicInfo;
#[allow(unused)]
pub fn panic_handler(info: &PanicInfo) {
#[cfg(feature = "debug")]
{
let message = if let Some(message) =
info.payload().downcast_ref::<alloc::string::String>()
{
alloc::format!("Kernel panic {:?} at {:?}", message, info.location())
} else {
let message = info.payload().downcast_ref::<&str>();
alloc::format!("Kernel panic {:?} at {:?}", message, info.location())
};
#[cfg(any(target_arch = "wasm32", target_arch = "riscv64"))]
unsafe {
tezos_smart_rollup_core::smart_rollup_core::write_debug(
message.as_ptr(),
message.len(),
);
}
#[cfg(all(feature = "std", not(target_arch = "wasm32")))]
std::eprintln!("{}", message);
}
#[cfg(all(feature = "abort", target_arch = "wasm32"))]
std::process::abort()
}