impl Error for CompileError

This commit is contained in:
Shunsuke Shibayama 2022-09-25 23:43:31 +09:00
parent 7fad8d9eee
commit 792c0ca3b4
3 changed files with 22 additions and 2 deletions

View file

@ -564,6 +564,19 @@ pub trait ErrorDisplay {
}
}
#[macro_export]
macro_rules! impl_display_and_error {
($Strc: ident) => {
impl std::fmt::Display for $Strc {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
$crate::error::ErrorDisplay::format(self, f)
}
}
impl std::error::Error for $Strc {}
};
}
pub trait MultiErrorDisplay<Item: ErrorDisplay>: Stream<Item> {
fn fmt_all_stderr(&self) {
for err in self.iter() {