diff options
Diffstat (limited to 'vendor/anyhow')
-rw-r--r-- | vendor/anyhow/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/anyhow/Cargo.toml | 2 | ||||
-rw-r--r-- | vendor/anyhow/build.rs | 32 | ||||
-rw-r--r-- | vendor/anyhow/src/backtrace.rs | 2 | ||||
-rw-r--r-- | vendor/anyhow/src/context.rs | 25 | ||||
-rw-r--r-- | vendor/anyhow/src/ensure.rs | 20 | ||||
-rw-r--r-- | vendor/anyhow/src/error.rs | 40 | ||||
-rw-r--r-- | vendor/anyhow/src/kind.rs | 4 | ||||
-rw-r--r-- | vendor/anyhow/src/lib.rs | 6 | ||||
-rw-r--r-- | vendor/anyhow/src/macros.rs | 32 | ||||
-rw-r--r-- | vendor/anyhow/src/wrapper.rs | 13 | ||||
-rw-r--r-- | vendor/anyhow/tests/test_ensure.rs | 2 | ||||
-rw-r--r-- | vendor/anyhow/tests/ui/must-use.stderr | 2 | ||||
-rw-r--r-- | vendor/anyhow/tests/ui/no-impl.stderr | 12 |
14 files changed, 117 insertions, 77 deletions
diff --git a/vendor/anyhow/.cargo-checksum.json b/vendor/anyhow/.cargo-checksum.json index 7b37c5570..5bbee7b7b 100644 --- a/vendor/anyhow/.cargo-checksum.json +++ b/vendor/anyhow/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"b83515ea98aa6ba603307c3629b86b0ad85e3017df8fe9f444c4bc8e0fc18c03","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"4bd4d352368ac0f5447031d82454490f6ac0c80d2fa4cb64ba0c23c614670d49","build.rs":"f82a81a4c16e3b68140e10c3d3a9ee54af48c53133a1d894fbb92190f09f0550","rust-toolchain.toml":"6bbb61302978c736b2da03e4fb40e3beab908f85d533ab46fd541e637b5f3e0f","src/backtrace.rs":"5a60bd1fe1717c044c7ab34c062ce6651c0cb08596a5878e391c2755ecac07f9","src/chain.rs":"6edefc5f3c7d69683095862e54e3bb56faba5b3387bf2eeaed429da090007a0a","src/context.rs":"559478ae785ce913523aa21358cc1561ef4b0b95c5c87675a77890364c0162fe","src/ensure.rs":"ba404f1708d41a267f8678858aebefadc8fae717bd5533e5ebb47e219aa44f7e","src/error.rs":"6c5b1357eedd6f2be1fdaee1be645a33e68c945c481d6ff20b98c8fdedea687a","src/fmt.rs":"c2d4aad6ce20625a70a7c091e3087b6a2c19a4a87c7a12edb4c98978307245ea","src/kind.rs":"b21b15dbee77d50abe88684a9571b39659076465dd4b1956f366af8fdd26e95a","src/lib.rs":"b340e18f5666d53289ce3428054e9789009cf60ea3e9ff717b3a4028fbaba6c2","src/macros.rs":"4ff9a40d7ff06cc02b387f40d6ae296990493cd7f9755880c621c47e7e845f07","src/ptr.rs":"f4e28bc9feba1e84160ca9d185008a51b5d72e168e6546f3e942f4258c361e19","src/wrapper.rs":"1229beca67dbd95ca77c9ecce282272acc55276c267c58cb73a75388b4693dda","tests/common/mod.rs":"f9088c2d7afafa64ff730b629272045b776bfafc2f5957508242da630635f2e1","tests/compiletest.rs":"022a8e400ef813d7ea1875b944549cee5125f6a995dc33e93b48cba3e1b57bd1","tests/drop/mod.rs":"08c3e553c1cc0d2dbd936fc45f4b5b1105057186affd6865e8d261e05f0f0646","tests/test_autotrait.rs":"981e792db353be2f14c7a1cabe43b5f1329c168cb7679077cc2be786a0920d48","tests/test_backtrace.rs":"0e50edbb33b6bd07ba89ff3db72fb7c688ba2a4371fccdbbb20309ab02948b6a","tests/test_boxed.rs":"6b26db0e2eb72afe9af7352ea820837aab90f8d486294616dd5dc34c1b94038c","tests/test_chain.rs":"d5e90e3eba58abc60d241d3aade39e0b8d4006d9a14f3cf015d3d925160b5812","tests/test_context.rs":"8409c53b328562c11e822bd6c3cd17e0d4d50b9bbb8fc3617333fd77303a6a33","tests/test_convert.rs":"7e7a8b4772a427a911014ac4d1083f9519000e786177f898808980dd9bdfde61","tests/test_downcast.rs":"797e69a72d125758c4c4897e5dc776d549d52cc9a6a633e0a33193f588a62b88","tests/test_ensure.rs":"bd793da08a4d01b8211646d82bec73468e54f6caf5f520617519a12cbb6659b9","tests/test_ffi.rs":"d0cb4c1d6d9154090982dee72ae3ebe05a5981f976058c3250f1c9da5a45edef","tests/test_fmt.rs":"17572596f257aac9aa2ec4620e292ca6a954128b94772bb948399fab53832e70","tests/test_macros.rs":"11f05010bc9b16319884c1286444100e30cddc2ecd1ffe5e0fd3fee5ffb32683","tests/test_repr.rs":"dbb9b04ddbe1ab31eb5331ea69f05bb3a147299da2275a3d4dcc92947b5591b9","tests/test_source.rs":"b80723cf635a4f8c4df21891b34bfab9ed2b2aa407e7a2f826d24e334cd5f88e","tests/ui/chained-comparison.rs":"6504b03d95b5acc232a7f4defc9f343b2be6733bf475fa0992e8e6545b912bd4","tests/ui/chained-comparison.stderr":"7f1d0a8c251b0ede2d30b3087ec157fc660945c97a642c4a5acf5a14ec58de34","tests/ui/empty-ensure.rs":"ab5bf37c846a0d689f26ce9257a27228411ed64154f9c950f1602d88a355d94b","tests/ui/empty-ensure.stderr":"345102cbef47310f2f4066a669199873a627ca4f1fcb885505c6e17d1fc95e88","tests/ui/must-use.rs":"fb59860b43f673bf4a430a6036ba463e95028844d8dd4243cfe5ebc7f2be582f","tests/ui/must-use.stderr":"4dc15f52c3a186251c948b6a2955b777ed3c88e5da94b887f8ff945b3ecd8cee","tests/ui/no-impl.rs":"fab6cbf2f6ea510b86f567dfb3b7c31250a9fd71ae5d110dbb9188be569ec593","tests/ui/no-impl.stderr":"39d3234c0cbb6213a422485cd1bf64b0877d2b2ea3e168b099bc8a6c1e0d33df","tests/ui/temporary-value.rs":"4dcc96271b2403e6372cf4cfc813445e5ce4365fc6e156b6bc38274098499a70","tests/ui/temporary-value.stderr":"64e448b6759cf51d41b1360307a638452bbe53ffa706f93e4a503b712d7b89a8","tests/ui/wrong-interpolation.rs":"9c44d4674c2dccd27b9dedd03341346ec02d993b41793ee89b5755202e7e367e","tests/ui/wrong-interpolation.stderr":"301e60e2eb9401782c7dc0b3580613a4cb2aafd4cc8065734a630a62e1161aa5"},"package":"c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142"}
\ No newline at end of file +{"files":{"Cargo.toml":"5779c6bea2555cdabd4560de187ac5e3c88ff2df8172077397643edc51c6fcc3","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"4bd4d352368ac0f5447031d82454490f6ac0c80d2fa4cb64ba0c23c614670d49","build.rs":"88bf7100143c79c0af683da7f28deaac031c9b9b213a6426560dc089b0ba45aa","rust-toolchain.toml":"6bbb61302978c736b2da03e4fb40e3beab908f85d533ab46fd541e637b5f3e0f","src/backtrace.rs":"5b4103a7d24d6f438a64b8cc0fafe28d55fc0ca090368174ce44d64e3940badd","src/chain.rs":"6edefc5f3c7d69683095862e54e3bb56faba5b3387bf2eeaed429da090007a0a","src/context.rs":"0bb1566aae147d393796dd6ede6ba329916e0a373b7cbc38335c3eeeb3d48b57","src/ensure.rs":"498bc9c7fb8b93168ed12f532cb97df6ccdda9ce25371586d7f5b1b1c98a14bf","src/error.rs":"e45d4dcfe64b1823b42fbf9bb260e6437987e8c2d51f92434db9d808b36e700a","src/fmt.rs":"c2d4aad6ce20625a70a7c091e3087b6a2c19a4a87c7a12edb4c98978307245ea","src/kind.rs":"332854c5eb07d44447c356a2e7dc585634b0da1ffbbfa81269c369deaefbc247","src/lib.rs":"82011e86fb9b41fe10ab2fde2b797b4858e697e7ead3a5f0d30b018357f1721d","src/macros.rs":"dd35f2ec2a0a25e4504fb04bcd42f6d0963bc0035aaaefc412f5ee1d78945fe1","src/ptr.rs":"f4e28bc9feba1e84160ca9d185008a51b5d72e168e6546f3e942f4258c361e19","src/wrapper.rs":"ff3ad72065a30cc32e9acb0614a30703c49c57b941a335c348b6439af684316b","tests/common/mod.rs":"f9088c2d7afafa64ff730b629272045b776bfafc2f5957508242da630635f2e1","tests/compiletest.rs":"022a8e400ef813d7ea1875b944549cee5125f6a995dc33e93b48cba3e1b57bd1","tests/drop/mod.rs":"08c3e553c1cc0d2dbd936fc45f4b5b1105057186affd6865e8d261e05f0f0646","tests/test_autotrait.rs":"981e792db353be2f14c7a1cabe43b5f1329c168cb7679077cc2be786a0920d48","tests/test_backtrace.rs":"0e50edbb33b6bd07ba89ff3db72fb7c688ba2a4371fccdbbb20309ab02948b6a","tests/test_boxed.rs":"6b26db0e2eb72afe9af7352ea820837aab90f8d486294616dd5dc34c1b94038c","tests/test_chain.rs":"d5e90e3eba58abc60d241d3aade39e0b8d4006d9a14f3cf015d3d925160b5812","tests/test_context.rs":"8409c53b328562c11e822bd6c3cd17e0d4d50b9bbb8fc3617333fd77303a6a33","tests/test_convert.rs":"7e7a8b4772a427a911014ac4d1083f9519000e786177f898808980dd9bdfde61","tests/test_downcast.rs":"797e69a72d125758c4c4897e5dc776d549d52cc9a6a633e0a33193f588a62b88","tests/test_ensure.rs":"c8137a9565685aedf02b365008b27c707f4c3d81cd2b986b3b7105b426c723b1","tests/test_ffi.rs":"d0cb4c1d6d9154090982dee72ae3ebe05a5981f976058c3250f1c9da5a45edef","tests/test_fmt.rs":"17572596f257aac9aa2ec4620e292ca6a954128b94772bb948399fab53832e70","tests/test_macros.rs":"11f05010bc9b16319884c1286444100e30cddc2ecd1ffe5e0fd3fee5ffb32683","tests/test_repr.rs":"dbb9b04ddbe1ab31eb5331ea69f05bb3a147299da2275a3d4dcc92947b5591b9","tests/test_source.rs":"b80723cf635a4f8c4df21891b34bfab9ed2b2aa407e7a2f826d24e334cd5f88e","tests/ui/chained-comparison.rs":"6504b03d95b5acc232a7f4defc9f343b2be6733bf475fa0992e8e6545b912bd4","tests/ui/chained-comparison.stderr":"7f1d0a8c251b0ede2d30b3087ec157fc660945c97a642c4a5acf5a14ec58de34","tests/ui/empty-ensure.rs":"ab5bf37c846a0d689f26ce9257a27228411ed64154f9c950f1602d88a355d94b","tests/ui/empty-ensure.stderr":"345102cbef47310f2f4066a669199873a627ca4f1fcb885505c6e17d1fc95e88","tests/ui/must-use.rs":"fb59860b43f673bf4a430a6036ba463e95028844d8dd4243cfe5ebc7f2be582f","tests/ui/must-use.stderr":"c2848c5f254b4c061eea6714d9baf709924aba06619eaf2a8b3aee1266b75f9e","tests/ui/no-impl.rs":"fab6cbf2f6ea510b86f567dfb3b7c31250a9fd71ae5d110dbb9188be569ec593","tests/ui/no-impl.stderr":"9d36a96220f0b5a81db027bcba411a61a72cc2e370c38058ab556442e8bb8a8b","tests/ui/temporary-value.rs":"4dcc96271b2403e6372cf4cfc813445e5ce4365fc6e156b6bc38274098499a70","tests/ui/temporary-value.stderr":"64e448b6759cf51d41b1360307a638452bbe53ffa706f93e4a503b712d7b89a8","tests/ui/wrong-interpolation.rs":"9c44d4674c2dccd27b9dedd03341346ec02d993b41793ee89b5755202e7e367e","tests/ui/wrong-interpolation.stderr":"301e60e2eb9401782c7dc0b3580613a4cb2aafd4cc8065734a630a62e1161aa5"},"package":"98161a4e3e2184da77bb14f02184cdd111e83bbbcc9979dfee3c44b9a85f5602"}
\ No newline at end of file diff --git a/vendor/anyhow/Cargo.toml b/vendor/anyhow/Cargo.toml index 6537f7b5f..844c2bd3a 100644 --- a/vendor/anyhow/Cargo.toml +++ b/vendor/anyhow/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" rust-version = "1.38" name = "anyhow" -version = "1.0.60" +version = "1.0.65" authors = ["David Tolnay <dtolnay@gmail.com>"] description = "Flexible concrete Error type built on std::error::Error" documentation = "https://docs.rs/anyhow" diff --git a/vendor/anyhow/build.rs b/vendor/anyhow/build.rs index c470ba11b..38006832e 100644 --- a/vendor/anyhow/build.rs +++ b/vendor/anyhow/build.rs @@ -15,15 +15,17 @@ compile_error! { // type. If the current toolchain is able to compile it, we go ahead and use // backtrace in anyhow. const PROBE: &str = r#" - #![feature(backtrace)] - #![allow(dead_code)] + #![feature(error_generic_member_access, provide_any)] + use std::any::{Demand, Provider}; use std::backtrace::{Backtrace, BacktraceStatus}; use std::error::Error; use std::fmt::{self, Display}; #[derive(Debug)] - struct E; + struct E { + backtrace: Backtrace, + } impl Display for E { fn fmt(&self, _formatter: &mut fmt::Formatter) -> fmt::Result { @@ -32,14 +34,26 @@ const PROBE: &str = r#" } impl Error for E { - fn backtrace(&self) -> Option<&Backtrace> { - let backtrace = Backtrace::capture(); - match backtrace.status() { - BacktraceStatus::Captured | BacktraceStatus::Disabled | _ => {} - } - unimplemented!() + fn provide<'a>(&'a self, demand: &mut Demand<'a>) { + demand.provide_ref(&self.backtrace); } } + + struct P; + + impl Provider for P { + fn provide<'a>(&'a self, _demand: &mut Demand<'a>) {} + } + + const _: fn() = || { + let backtrace: Backtrace = Backtrace::capture(); + let status: BacktraceStatus = backtrace.status(); + match status { + BacktraceStatus::Captured | BacktraceStatus::Disabled | _ => {} + } + }; + + const _: fn(&dyn Error) -> Option<&Backtrace> = |err| err.request_ref::<Backtrace>(); "#; fn main() { diff --git a/vendor/anyhow/src/backtrace.rs b/vendor/anyhow/src/backtrace.rs index e4c907641..23c0c85ce 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.backtrace() { + match ($err as &dyn std::error::Error).request_ref::<std::backtrace::Backtrace>() { Some(_) => None, None => backtrace!(), } 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); diff --git a/vendor/anyhow/src/ensure.rs b/vendor/anyhow/src/ensure.rs index 80bdab704..0ab447123 100644 --- a/vendor/anyhow/src/ensure.rs +++ b/vendor/anyhow/src/ensure.rs @@ -788,15 +788,15 @@ macro_rules! __fancy_ensure { (lhs, rhs) => { if !(lhs $op rhs) { #[allow(unused_imports)] - use $crate::private::{BothDebug, NotBothDebug}; + use $crate::__private::{BothDebug, NotBothDebug}; return Err((lhs, rhs).__dispatch_ensure( - $crate::private::concat!( + $crate::__private::concat!( "Condition failed: `", - $crate::private::stringify!($lhs), + $crate::__private::stringify!($lhs), " ", - $crate::private::stringify!($op), + $crate::__private::stringify!($op), " ", - $crate::private::stringify!($rhs), + $crate::__private::stringify!($rhs), "`", ), )); @@ -811,24 +811,24 @@ macro_rules! __fancy_ensure { macro_rules! __fallback_ensure { ($cond:expr $(,)?) => { if !$cond { - return $crate::private::Err($crate::Error::msg( - $crate::private::concat!("Condition failed: `", $crate::private::stringify!($cond), "`") + return $crate::__private::Err($crate::Error::msg( + $crate::__private::concat!("Condition failed: `", $crate::__private::stringify!($cond), "`") )); } }; ($cond:expr, $msg:literal $(,)?) => { if !$cond { - return $crate::private::Err($crate::__anyhow!($msg)); + return $crate::__private::Err($crate::__anyhow!($msg)); } }; ($cond:expr, $err:expr $(,)?) => { if !$cond { - return $crate::private::Err($crate::__anyhow!($err)); + return $crate::__private::Err($crate::__anyhow!($err)); } }; ($cond:expr, $fmt:expr, $($arg:tt)*) => { if !$cond { - return $crate::private::Err($crate::__anyhow!($fmt, $($arg)*)); + return $crate::__private::Err($crate::__anyhow!($fmt, $($arg)*)); } }; } diff --git a/vendor/anyhow/src/error.rs b/vendor/anyhow/src/error.rs index 0971146c9..9f6ce8c10 100644 --- a/vendor/anyhow/src/error.rs +++ b/vendor/anyhow/src/error.rs @@ -5,6 +5,8 @@ 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; @@ -31,7 +33,7 @@ impl Error { where E: StdError + Send + Sync + 'static, { - let backtrace = backtrace_if_absent!(error); + let backtrace = backtrace_if_absent!(&error); Error::from_std(error, backtrace) } @@ -522,6 +524,18 @@ impl Error { } } +#[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. + fn provide<'a>(&'a self, demand: &mut Demand<'a>) { + unsafe { ErrorImpl::provide(self.inner.by_ref(), demand) } + } +} + #[cfg(feature = "std")] #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] impl<E> From<E> for Error @@ -530,7 +544,7 @@ where { #[cold] fn from(error: E) -> Self { - let backtrace = backtrace_if_absent!(error); + let backtrace = backtrace_if_absent!(&error); Error::from_std(error, backtrace) } } @@ -886,13 +900,21 @@ impl ErrorImpl { .as_ref() .or_else(|| { #[cfg(backtrace)] - return Self::error(this).backtrace(); - #[cfg(all(not(backtrace), feature = "backtrace"))] + return Self::error(this).request_ref::<Backtrace>(); + #[cfg(not(backtrace))] return (vtable(this.ptr).object_backtrace)(this); }) .expect("backtrace capture failed") } + #[cfg(backtrace)] + unsafe fn provide<'a>(this: Ref<'a, Self>, demand: &mut Demand<'a>) { + if let Some(backtrace) = &this.deref().backtrace { + demand.provide_ref(backtrace); + } + Self::error(this).provide(demand); + } + #[cold] pub(crate) unsafe fn chain(this: Ref<Self>) -> Chain { Chain::new(Self::error(this)) @@ -903,14 +925,14 @@ impl<E> StdError for ErrorImpl<E> where E: StdError, { - #[cfg(backtrace)] - fn backtrace(&self) -> Option<&Backtrace> { - Some(unsafe { ErrorImpl::backtrace(self.erase()) }) - } - fn source(&self) -> Option<&(dyn StdError + 'static)> { unsafe { ErrorImpl::error(self.erase()).source() } } + + #[cfg(backtrace)] + fn provide<'a>(&'a self, demand: &mut Demand<'a>) { + unsafe { ErrorImpl::provide(self.erase(), demand) } + } } impl<E> Debug for ErrorImpl<E> diff --git a/vendor/anyhow/src/kind.rs b/vendor/anyhow/src/kind.rs index 59857057d..f47fe44ba 100644 --- a/vendor/anyhow/src/kind.rs +++ b/vendor/anyhow/src/kind.rs @@ -40,7 +40,7 @@ // The anyhow! macro will set up the call in this form: // // #[allow(unused_imports)] -// use $crate::private::{AdhocKind, TraitKind}; +// use $crate::__private::{AdhocKind, TraitKind}; // let error = $msg; // (&error).anyhow_kind().new(error) @@ -110,7 +110,7 @@ impl BoxedKind for Box<dyn StdError + Send + Sync> {} impl Boxed { #[cold] pub fn new(self, error: Box<dyn StdError + Send + Sync>) -> Error { - let backtrace = backtrace_if_absent!(error); + let backtrace = backtrace_if_absent!(&*error); Error::from_boxed(error, backtrace) } } diff --git a/vendor/anyhow/src/lib.rs b/vendor/anyhow/src/lib.rs index 976668aab..792a4d007 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.60")] -#![cfg_attr(backtrace, feature(backtrace))] +#![doc(html_root_url = "https://docs.rs/anyhow/1.0.65")] +#![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(not(feature = "std"), no_std)] #![deny(dead_code, unused_imports, unused_mut)] @@ -634,7 +634,7 @@ pub fn Ok<T>(t: T) -> Result<T> { // Not public API. Referenced by macro-generated code. #[doc(hidden)] -pub mod private { +pub mod __private { use crate::Error; use alloc::fmt; use core::fmt::Arguments; diff --git a/vendor/anyhow/src/macros.rs b/vendor/anyhow/src/macros.rs index 5dc138386..6dd22743b 100644 --- a/vendor/anyhow/src/macros.rs +++ b/vendor/anyhow/src/macros.rs @@ -55,13 +55,13 @@ #[macro_export] macro_rules! bail { ($msg:literal $(,)?) => { - return $crate::private::Err($crate::__anyhow!($msg)) + return $crate::__private::Err($crate::__anyhow!($msg)) }; ($err:expr $(,)?) => { - return $crate::private::Err($crate::__anyhow!($err)) + return $crate::__private::Err($crate::__anyhow!($err)) }; ($fmt:expr, $($arg:tt)*) => { - return $crate::private::Err($crate::__anyhow!($fmt, $($arg)*)) + return $crate::__private::Err($crate::__anyhow!($fmt, $($arg)*)) }; } @@ -120,24 +120,24 @@ macro_rules! bail { macro_rules! ensure { ($cond:expr $(,)?) => { if !$cond { - return $crate::private::Err($crate::Error::msg( - $crate::private::concat!("Condition failed: `", $crate::private::stringify!($cond), "`") + return $crate::__private::Err($crate::Error::msg( + $crate::__private::concat!("Condition failed: `", $crate::__private::stringify!($cond), "`") )); } }; ($cond:expr, $msg:literal $(,)?) => { if !$cond { - return $crate::private::Err($crate::__anyhow!($msg)); + return $crate::__private::Err($crate::__anyhow!($msg)); } }; ($cond:expr, $err:expr $(,)?) => { if !$cond { - return $crate::private::Err($crate::__anyhow!($err)); + return $crate::__private::Err($crate::__anyhow!($err)); } }; ($cond:expr, $fmt:expr, $($arg:tt)*) => { if !$cond { - return $crate::private::Err($crate::__anyhow!($fmt, $($arg)*)); + return $crate::__private::Err($crate::__anyhow!($fmt, $($arg)*)); } }; } @@ -189,14 +189,14 @@ macro_rules! ensure { #[macro_export] macro_rules! anyhow { ($msg:literal $(,)?) => { - $crate::private::must_use({ - let error = $crate::private::format_err($crate::private::format_args!($msg)); + $crate::__private::must_use({ + let error = $crate::__private::format_err($crate::__private::format_args!($msg)); error }) }; ($err:expr $(,)?) => { - $crate::private::must_use({ - use $crate::private::kind::*; + $crate::__private::must_use({ + use $crate::__private::kind::*; let error = match $err { error => (&error).anyhow_kind().new(error), }; @@ -204,7 +204,7 @@ macro_rules! anyhow { }) }; ($fmt:expr, $($arg:tt)*) => { - $crate::Error::msg($crate::private::format!($fmt, $($arg)*)) + $crate::Error::msg($crate::__private::format!($fmt, $($arg)*)) }; } @@ -215,17 +215,17 @@ macro_rules! anyhow { #[macro_export] macro_rules! __anyhow { ($msg:literal $(,)?) => ({ - let error = $crate::private::format_err($crate::private::format_args!($msg)); + let error = $crate::__private::format_err($crate::__private::format_args!($msg)); error }); ($err:expr $(,)?) => ({ - use $crate::private::kind::*; + use $crate::__private::kind::*; let error = match $err { error => (&error).anyhow_kind().new(error), }; error }); ($fmt:expr, $($arg:tt)*) => { - $crate::Error::msg($crate::private::format!($fmt, $($arg)*)) + $crate::Error::msg($crate::__private::format!($fmt, $($arg)*)) }; } diff --git a/vendor/anyhow/src/wrapper.rs b/vendor/anyhow/src/wrapper.rs index 3ebe51a88..5f18a5031 100644 --- a/vendor/anyhow/src/wrapper.rs +++ b/vendor/anyhow/src/wrapper.rs @@ -1,6 +1,9 @@ use crate::StdError; use core::fmt::{self, Debug, Display}; +#[cfg(backtrace)] +use std::any::Demand; + #[repr(transparent)] pub struct MessageError<M>(pub M); @@ -67,12 +70,12 @@ impl Display for BoxedError { #[cfg(feature = "std")] impl StdError for BoxedError { - #[cfg(backtrace)] - fn backtrace(&self) -> Option<&crate::backtrace::Backtrace> { - self.0.backtrace() - } - fn source(&self) -> Option<&(dyn StdError + 'static)> { self.0.source() } + + #[cfg(backtrace)] + fn provide<'a>(&'a self, demand: &mut Demand<'a>) { + self.0.provide(demand); + } } diff --git a/vendor/anyhow/tests/test_ensure.rs b/vendor/anyhow/tests/test_ensure.rs index 4bb12f9fa..cbcba5798 100644 --- a/vendor/anyhow/tests/test_ensure.rs +++ b/vendor/anyhow/tests/test_ensure.rs @@ -5,9 +5,9 @@ clippy::items_after_statements, clippy::let_and_return, clippy::let_underscore_drop, - clippy::logic_bug, clippy::match_bool, clippy::never_loop, + clippy::overly_complex_bool_expr, clippy::redundant_closure_call, clippy::redundant_pattern_matching, clippy::too_many_lines, diff --git a/vendor/anyhow/tests/ui/must-use.stderr b/vendor/anyhow/tests/ui/must-use.stderr index e9ee24b09..e10bde40f 100644 --- a/vendor/anyhow/tests/ui/must-use.stderr +++ b/vendor/anyhow/tests/ui/must-use.stderr @@ -1,4 +1,4 @@ -error: unused return value of `anyhow::private::must_use` that must be used +error: unused return value of `anyhow::__private::must_use` that must be used --> tests/ui/must-use.rs:8:9 | 8 | anyhow!("it failed"); diff --git a/vendor/anyhow/tests/ui/no-impl.stderr b/vendor/anyhow/tests/ui/no-impl.stderr index 7c5ec503f..074dafe62 100644 --- a/vendor/anyhow/tests/ui/no-impl.stderr +++ b/vendor/anyhow/tests/ui/no-impl.stderr @@ -19,13 +19,13 @@ error[E0599]: the method `anyhow_kind` exists for reference `&Error`, but its tr `&Error: Into<anyhow::Error>` which is required by `&Error: anyhow::kind::TraitKind` note: the following traits must be implemented - --> $RUST/core/src/convert/mod.rs - | - | pub trait Into<T>: Sized { - | ^^^^^^^^^^^^^^^^^^^^^^^^ - | - ::: $RUST/core/src/fmt/mod.rs + --> $RUST/core/src/fmt/mod.rs | | pub trait Display { | ^^^^^^^^^^^^^^^^^ + | + ::: $RUST/core/src/convert/mod.rs + | + | pub trait Into<T>: Sized { + | ^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `anyhow` (in Nightly builds, run with -Z macro-backtrace for more info) |