From 1a27033d7afd0007907550b1fc9d589d6f658662 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 24 Oct 2022 17:33:14 -0700 Subject: [PATCH] feat(error): impl AsRef for Report This seems like an easy implementation to fill out, and will be used for tests in the following commit. --- src/eyreish/error.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/eyreish/error.rs b/src/eyreish/error.rs index 32f1d1f..6b0dc34 100644 --- a/src/eyreish/error.rs +++ b/src/eyreish/error.rs @@ -791,6 +791,18 @@ impl AsRef for Report { } } +impl AsRef for Report { + fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) { + unsafe { ErrorImpl::error(self.inner.by_ref()) } + } +} + +impl AsRef for Report { + fn as_ref(&self) -> &(dyn StdError + 'static) { + unsafe { ErrorImpl::error(self.inner.by_ref()) } + } +} + impl std::borrow::Borrow for Report { fn borrow(&self) -> &(dyn Diagnostic + 'static) { self.as_ref()