diff --git a/src/error.rs b/src/error.rs index d707297..9f6ce8c 100644 --- a/src/error.rs +++ b/src/error.rs @@ -522,15 +522,16 @@ impl Error { Some(addr.cast::().deref_mut()) } } +} +#[cfg(backtrace)] +impl std::any::Provider for Error { // Called by thiserror when you have `#[source] anyhow::Error`. This provide // implementation includes the anyhow::Error's Backtrace if any, unlike // deref'ing to dyn Error where the provide implementation would include // only the original error's Backtrace from before it got wrapped into an // anyhow::Error. - #[cfg(backtrace)] - #[doc(hidden)] - pub fn provide<'a>(&'a self, demand: &mut Demand<'a>) { + fn provide<'a>(&'a self, demand: &mut Demand<'a>) { unsafe { ErrorImpl::provide(self.inner.by_ref(), demand) } } }