summaryrefslogtreecommitdiffstats
path: root/vendor/anyhow/src/context.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/anyhow/src/context.rs
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--vendor/anyhow/src/context.rs25
1 files changed, 13 insertions, 12 deletions
diff --git a/vendor/anyhow/src/context.rs b/vendor/anyhow/src/context.rs
index c2284130f..1b7dd31ac 100644
--- a/vendor/anyhow/src/context.rs
+++ b/vendor/anyhow/src/context.rs
@@ -4,7 +4,7 @@ use core::convert::Infallible;
use core::fmt::{self, Debug, Display, Write};
#[cfg(backtrace)]
-use std::backtrace::Backtrace;
+use std::any::Demand;
mod ext {
use super::*;
@@ -24,7 +24,7 @@ mod ext {
where
C: Display + Send + Sync + 'static,
{
- let backtrace = backtrace_if_absent!(self);
+ let backtrace = backtrace_if_absent!(&self);
Error::from_context(context, self, backtrace)
}
}
@@ -123,28 +123,29 @@ where
C: Display,
E: StdError + 'static,
{
- #[cfg(backtrace)]
- fn backtrace(&self) -> Option<&Backtrace> {
- self.error.backtrace()
- }
-
fn source(&self) -> Option<&(dyn StdError + 'static)> {
Some(&self.error)
}
+
+ #[cfg(backtrace)]
+ fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
+ self.error.provide(demand);
+ }
}
impl<C> StdError for ContextError<C, Error>
where
C: Display,
{
- #[cfg(backtrace)]
- fn backtrace(&self) -> Option<&Backtrace> {
- Some(self.error.backtrace())
- }
-
fn source(&self) -> Option<&(dyn StdError + 'static)> {
Some(unsafe { crate::ErrorImpl::error(self.error.inner.by_ref()) })
}
+
+ #[cfg(backtrace)]
+ fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
+ demand.provide_ref(self.error.backtrace());
+ self.error.provide(demand);
+ }
}
struct Quoted<C>(C);