rustc panics

This commit is contained in:
Dominik Werder
2023-07-18 11:27:39 +02:00
parent 2054f6c23f
commit 91947dec0f
49 changed files with 982 additions and 679 deletions

View File

@@ -3,6 +3,8 @@
pub use anyhow;
pub use thiserror;
pub use thiserror::Error as ThisError;
pub use thiserror::UserErrorClass;
pub use thiserror::UserErrorContent;
pub mod bt {
pub use backtrace::Backtrace;
@@ -476,7 +478,7 @@ pub fn todoval<T>() -> T {
todo!("TODO todoval\n{bt:?}")
}
pub trait ToPublicError: std::error::Error {
pub trait ToPublicError: std::error::Error + Send {
fn to_public_error(&self) -> String;
}
@@ -546,6 +548,19 @@ mod test {
assert_eq!(s, "SomeErrorEnumB0::FromA(SomeErrorEnumA::BadCase)");
}
#[test]
fn error_handle_b0_user_00() {
use thiserror::UserErrorClass;
use thiserror::UserErrorInfo;
let e = failing_b0_00().unwrap_err();
let s = e.class();
if let UserErrorClass::Unspecified = s {
()
} else {
panic!()
}
}
#[test]
fn error_handle_b1_00() {
let e = failing_b1_00().unwrap_err();