add panic suite to Error

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-07-10 06:35:11 +00:00
parent f10f5319db
commit 0627b46f40
3 changed files with 60 additions and 20 deletions

View file

@ -1,6 +1,4 @@
#![allow(dead_code)] // this is a developer's toolbox
use std::panic;
use std::{any::Any, panic};
/// Export all of the ancillary tools from here as well.
pub use crate::utils::debug::*;
@ -79,3 +77,6 @@ pub fn trap() {
std::arch::asm!("int3");
}
}
#[must_use]
pub fn panic_str(p: &Box<dyn Any + Send>) -> &'static str { p.downcast_ref::<&str>().copied().unwrap_or_default() }