feat(error): impl AsRef<dyn StdError> for Report

This seems like an easy implementation to fill out, and will be used for
tests in the following commit.
This commit is contained in:
Rain 2022-10-24 17:33:14 -07:00
parent 5569cd9898
commit d3603a9a1f
1 changed files with 12 additions and 0 deletions

View File

@ -791,6 +791,18 @@ impl AsRef<dyn Diagnostic> for Report {
}
}
impl AsRef<dyn StdError + Send + Sync> for Report {
fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) {
unsafe { ErrorImpl::error(self.inner.by_ref()) }
}
}
impl AsRef<dyn StdError> for Report {
fn as_ref(&self) -> &(dyn StdError + 'static) {
unsafe { ErrorImpl::error(self.inner.by_ref()) }
}
}
impl std::borrow::Borrow<dyn Diagnostic> for Report {
fn borrow(&self) -> &(dyn Diagnostic + 'static) {
self.as_ref()