diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/anyhow/src | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/anyhow/src')
-rw-r--r-- | vendor/anyhow/src/backtrace.rs | 2 | ||||
-rw-r--r-- | vendor/anyhow/src/context.rs | 10 | ||||
-rw-r--r-- | vendor/anyhow/src/error.rs | 30 | ||||
-rw-r--r-- | vendor/anyhow/src/kind.rs | 3 | ||||
-rw-r--r-- | vendor/anyhow/src/lib.rs | 10 | ||||
-rw-r--r-- | vendor/anyhow/src/wrapper.rs | 6 |
6 files changed, 37 insertions, 24 deletions
diff --git a/vendor/anyhow/src/backtrace.rs b/vendor/anyhow/src/backtrace.rs index 23c0c85ce..7c1906b09 100644 --- a/vendor/anyhow/src/backtrace.rs +++ b/vendor/anyhow/src/backtrace.rs @@ -38,7 +38,7 @@ macro_rules! backtrace { #[cfg(backtrace)] macro_rules! backtrace_if_absent { ($err:expr) => { - match ($err as &dyn std::error::Error).request_ref::<std::backtrace::Backtrace>() { + match std::error::request_ref::<std::backtrace::Backtrace>($err as &dyn std::error::Error) { Some(_) => None, None => backtrace!(), } diff --git a/vendor/anyhow/src/context.rs b/vendor/anyhow/src/context.rs index 9df86937b..d81b9a769 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::any::{Demand, Provider}; +use std::error::Request; mod ext { use super::*; @@ -144,8 +144,8 @@ where } #[cfg(backtrace)] - fn provide<'a>(&'a self, demand: &mut Demand<'a>) { - StdError::provide(&self.error, demand); + fn provide<'a>(&'a self, request: &mut Request<'a>) { + StdError::provide(&self.error, request); } } @@ -158,8 +158,8 @@ where } #[cfg(backtrace)] - fn provide<'a>(&'a self, demand: &mut Demand<'a>) { - Provider::provide(&self.error, demand); + fn provide<'a>(&'a self, request: &mut Request<'a>) { + Error::provide(&self.error, request); } } diff --git a/vendor/anyhow/src/error.rs b/vendor/anyhow/src/error.rs index 9f6ce8c10..01402d44c 100644 --- a/vendor/anyhow/src/error.rs +++ b/vendor/anyhow/src/error.rs @@ -5,14 +5,14 @@ use crate::ptr::Mut; use crate::ptr::{Own, Ref}; use crate::{Error, StdError}; use alloc::boxed::Box; -#[cfg(backtrace)] -use core::any::Demand; use core::any::TypeId; use core::fmt::{self, Debug, Display}; use core::mem::ManuallyDrop; #[cfg(not(anyhow_no_ptr_addr_of))] use core::ptr; use core::ptr::NonNull; +#[cfg(backtrace)] +use std::error::{self, Request}; #[cfg(feature = "std")] use core::ops::{Deref, DerefMut}; @@ -522,17 +522,21 @@ impl Error { Some(addr.cast::<E>().deref_mut()) } } -} -#[cfg(backtrace)] -impl std::any::Provider for Error { + #[cfg(backtrace)] + pub(crate) fn provide<'a>(&'a self, request: &mut Request<'a>) { + unsafe { ErrorImpl::provide(self.inner.by_ref(), request) } + } + // 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. - fn provide<'a>(&'a self, demand: &mut Demand<'a>) { - unsafe { ErrorImpl::provide(self.inner.by_ref(), demand) } + #[cfg(backtrace)] + #[doc(hidden)] + pub fn thiserror_provide<'a>(&'a self, request: &mut Request<'a>) { + Self::provide(self, request); } } @@ -900,7 +904,7 @@ impl ErrorImpl { .as_ref() .or_else(|| { #[cfg(backtrace)] - return Self::error(this).request_ref::<Backtrace>(); + return error::request_ref::<Backtrace>(Self::error(this)); #[cfg(not(backtrace))] return (vtable(this.ptr).object_backtrace)(this); }) @@ -908,11 +912,11 @@ impl ErrorImpl { } #[cfg(backtrace)] - unsafe fn provide<'a>(this: Ref<'a, Self>, demand: &mut Demand<'a>) { + unsafe fn provide<'a>(this: Ref<'a, Self>, request: &mut Request<'a>) { if let Some(backtrace) = &this.deref().backtrace { - demand.provide_ref(backtrace); + request.provide_ref(backtrace); } - Self::error(this).provide(demand); + Self::error(this).provide(request); } #[cold] @@ -930,8 +934,8 @@ where } #[cfg(backtrace)] - fn provide<'a>(&'a self, demand: &mut Demand<'a>) { - unsafe { ErrorImpl::provide(self.erase(), demand) } + fn provide<'a>(&'a self, request: &mut Request<'a>) { + unsafe { ErrorImpl::provide(self.erase(), request) } } } diff --git a/vendor/anyhow/src/kind.rs b/vendor/anyhow/src/kind.rs index f47fe44ba..21d76aa2d 100644 --- a/vendor/anyhow/src/kind.rs +++ b/vendor/anyhow/src/kind.rs @@ -52,6 +52,7 @@ use crate::StdError; pub struct Adhoc; +#[doc(hidden)] pub trait AdhocKind: Sized { #[inline] fn anyhow_kind(&self) -> Adhoc { @@ -73,6 +74,7 @@ impl Adhoc { pub struct Trait; +#[doc(hidden)] pub trait TraitKind: Sized { #[inline] fn anyhow_kind(&self) -> Trait { @@ -96,6 +98,7 @@ impl Trait { pub struct Boxed; #[cfg(feature = "std")] +#[doc(hidden)] pub trait BoxedKind: Sized { #[inline] fn anyhow_kind(&self) -> Boxed { diff --git a/vendor/anyhow/src/lib.rs b/vendor/anyhow/src/lib.rs index a946a810d..5ec17ada9 100644 --- a/vendor/anyhow/src/lib.rs +++ b/vendor/anyhow/src/lib.rs @@ -210,8 +210,8 @@ //! will require an explicit `.map_err(Error::msg)` when working with a //! non-Anyhow error type inside a function that returns Anyhow's error type. -#![doc(html_root_url = "https://docs.rs/anyhow/1.0.71")] -#![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))] +#![doc(html_root_url = "https://docs.rs/anyhow/1.0.75")] +#![cfg_attr(backtrace, feature(error_generic_member_access))] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(not(feature = "std"), no_std)] #![deny(dead_code, unused_imports, unused_mut)] @@ -642,16 +642,22 @@ pub mod __private { use alloc::fmt; use core::fmt::Arguments; + #[doc(hidden)] pub use crate::ensure::{BothDebug, NotBothDebug}; + #[doc(hidden)] pub use alloc::format; + #[doc(hidden)] pub use core::result::Result::Err; + #[doc(hidden)] pub use core::{concat, format_args, stringify}; #[doc(hidden)] pub mod kind { + #[doc(hidden)] pub use crate::kind::{AdhocKind, TraitKind}; #[cfg(feature = "std")] + #[doc(hidden)] pub use crate::kind::BoxedKind; } diff --git a/vendor/anyhow/src/wrapper.rs b/vendor/anyhow/src/wrapper.rs index 5f18a5031..8a6d686f6 100644 --- a/vendor/anyhow/src/wrapper.rs +++ b/vendor/anyhow/src/wrapper.rs @@ -2,7 +2,7 @@ use crate::StdError; use core::fmt::{self, Debug, Display}; #[cfg(backtrace)] -use std::any::Demand; +use std::error::Request; #[repr(transparent)] pub struct MessageError<M>(pub M); @@ -75,7 +75,7 @@ impl StdError for BoxedError { } #[cfg(backtrace)] - fn provide<'a>(&'a self, demand: &mut Demand<'a>) { - self.0.provide(demand); + fn provide<'a>(&'a self, request: &mut Request<'a>) { + self.0.provide(request); } } |