diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f539d6..9e8a9ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [nightly, beta, stable, 1.70.0] + rust: [nightly, beta, stable, 1.80.0, 1.70.0] timeout-minutes: 45 steps: - uses: actions/checkout@v4 @@ -41,6 +41,11 @@ jobs: - run: cargo test - run: cargo check --no-default-features - run: cargo check --features backtrace + - uses: actions/upload-artifact@v4 + if: matrix.rust == 'nightly' && always() + with: + name: Cargo.lock + path: Cargo.lock build: name: Rust ${{matrix.rust}} @@ -50,7 +55,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [1.65.0, 1.52.0, 1.51.0, 1.50.0, 1.39.0] + rust: [1.67.0, 1.65.0, 1.52.0, 1.51.0, 1.50.0, 1.39.0] timeout-minutes: 45 steps: - uses: actions/checkout@v4 @@ -61,7 +66,7 @@ jobs: - run: cargo check - run: cargo check --no-default-features - run: cargo check --features backtrace - if: matrix.rust != '1.52.0' && matrix.rust != '1.51.0' && matrix.rust != '1.50.0' && matrix.rust != '1.39.0' + if: matrix.rust != '1.65.0' && matrix.rust != '1.52.0' && matrix.rust != '1.51.0' && matrix.rust != '1.50.0' && matrix.rust != '1.39.0' minimal: name: Minimal versions diff --git a/Cargo.toml b/Cargo.toml index f91b724..41ab100 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "anyhow" -version = "1.0.86" +version = "1.0.87" authors = ["David Tolnay "] categories = ["rust-patterns", "no-std"] description = "Flexible concrete Error type built on std::error::Error" @@ -34,4 +34,4 @@ doc-scrape-examples = false [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] -rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"] +rustdoc-args = ["--generate-link-to-definition"] diff --git a/build.rs b/build.rs index 0d757e1..a065e04 100644 --- a/build.rs +++ b/build.rs @@ -67,10 +67,10 @@ fn main() { if rustc >= 80 { println!("cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)"); + println!("cargo:rustc-check-cfg=cfg(anyhow_no_core_error)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_ptr_addr_of)"); println!("cargo:rustc-check-cfg=cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)"); - println!("cargo:rustc-check-cfg=cfg(doc_cfg)"); println!("cargo:rustc-check-cfg=cfg(error_generic_member_access)"); println!("cargo:rustc-check-cfg=cfg(std_backtrace)"); } @@ -96,6 +96,12 @@ fn main() { // https://blog.rust-lang.org/2022/11/03/Rust-1.65.0.html#stabilized-apis println!("cargo:rustc-cfg=std_backtrace"); } + + if rustc < 81 { + // core::error::Error + // https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#coreerrorerror + println!("cargo:rustc-cfg=anyhow_no_core_error"); + } } fn compile_probe(rustc_bootstrap: bool) -> bool { diff --git a/build/probe.rs b/build/probe.rs index 21e776d..742d15c 100644 --- a/build/probe.rs +++ b/build/probe.rs @@ -4,9 +4,9 @@ #![feature(error_generic_member_access)] +use core::error::{self, Error, Request}; +use core::fmt::{self, Debug, Display}; use std::backtrace::Backtrace; -use std::error::{self, Error, Request}; -use std::fmt::{self, Debug, Display}; struct MyError(Thing); struct Thing; diff --git a/src/backtrace.rs b/src/backtrace.rs index 44fb66c..c9ca1a8 100644 --- a/src/backtrace.rs +++ b/src/backtrace.rs @@ -38,7 +38,8 @@ macro_rules! backtrace { #[cfg(error_generic_member_access)] macro_rules! backtrace_if_absent { ($err:expr) => { - match std::error::request_ref::($err as &dyn std::error::Error) { + match core::error::request_ref::($err as &dyn core::error::Error) + { Some(_) => None, None => backtrace!(), } @@ -46,7 +47,7 @@ macro_rules! backtrace_if_absent { } #[cfg(all( - feature = "std", + any(feature = "std", not(anyhow_no_core_error)), not(error_generic_member_access), any(std_backtrace, feature = "backtrace") ))] @@ -56,7 +57,11 @@ macro_rules! backtrace_if_absent { }; } -#[cfg(all(feature = "std", not(std_backtrace), not(feature = "backtrace")))] +#[cfg(all( + any(feature = "std", not(anyhow_no_core_error)), + not(std_backtrace), + not(feature = "backtrace"), +))] macro_rules! backtrace_if_absent { ($err:expr) => { None diff --git a/src/chain.rs b/src/chain.rs index b75885d..e56bc66 100644 --- a/src/chain.rs +++ b/src/chain.rs @@ -1,13 +1,13 @@ use self::ChainState::*; use crate::StdError; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] use alloc::vec::{self, Vec}; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] pub(crate) use crate::Chain; -#[cfg(not(feature = "std"))] +#[cfg(all(not(feature = "std"), anyhow_no_core_error))] pub(crate) struct Chain<'a> { state: ChainState<'a>, } @@ -17,7 +17,7 @@ pub(crate) enum ChainState<'a> { Linked { next: Option<&'a (dyn StdError + 'static)>, }, - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] Buffered { rest: vec::IntoIter<&'a (dyn StdError + 'static)>, }, @@ -42,7 +42,7 @@ impl<'a> Iterator for Chain<'a> { *next = error.source(); Some(error) } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] Buffered { rest } => rest.next(), } } @@ -53,7 +53,7 @@ impl<'a> Iterator for Chain<'a> { } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl DoubleEndedIterator for Chain<'_> { fn next_back(&mut self) -> Option { match &mut self.state { @@ -84,13 +84,13 @@ impl ExactSizeIterator for Chain<'_> { } len } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] Buffered { rest } => rest.len(), } } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl Default for Chain<'_> { fn default() -> Self { Chain { diff --git a/src/context.rs b/src/context.rs index 11b31ba..b52f682 100644 --- a/src/context.rs +++ b/src/context.rs @@ -4,7 +4,7 @@ use core::convert::Infallible; use core::fmt::{self, Debug, Display, Write}; #[cfg(error_generic_member_access)] -use std::error::Request; +use core::error::Request; mod ext { use super::*; @@ -15,10 +15,10 @@ mod ext { C: Display + Send + Sync + 'static; } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl StdError for E where - E: std::error::Error + Send + Sync + 'static, + E: crate::StdError + Send + Sync + 'static, { fn ext_context(self, context: C) -> Error where diff --git a/src/error.rs b/src/error.rs index f24c4a6..6d8b54d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,21 +1,20 @@ use crate::backtrace::Backtrace; use crate::chain::Chain; -#[cfg(any(feature = "std", anyhow_no_ptr_addr_of))] +#[cfg(any(feature = "std", not(anyhow_no_core_error), anyhow_no_ptr_addr_of))] use crate::ptr::Mut; use crate::ptr::{Own, Ref}; use crate::{Error, StdError}; use alloc::boxed::Box; use core::any::TypeId; +#[cfg(error_generic_member_access)] +use core::error::{self, Request}; use core::fmt::{self, Debug, Display}; use core::mem::ManuallyDrop; +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] +use core::ops::{Deref, DerefMut}; #[cfg(not(anyhow_no_ptr_addr_of))] use core::ptr; use core::ptr::NonNull; -#[cfg(error_generic_member_access)] -use std::error::{self, Request}; - -#[cfg(feature = "std")] -use core::ops::{Deref, DerefMut}; impl Error { /// Create a new error object from any error type. @@ -25,8 +24,7 @@ impl Error { /// /// If the error type does not provide a backtrace, a backtrace will be /// created here to ensure that a backtrace exists. - #[cfg(feature = "std")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[cold] #[must_use] pub fn new(error: E) -> Self @@ -83,7 +81,7 @@ impl Error { Error::from_adhoc(message, backtrace!()) } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[cold] pub(crate) fn from_std(error: E, backtrace: Option) -> Self where @@ -120,7 +118,7 @@ impl Error { let vtable = &ErrorVTable { object_drop: object_drop::>, object_ref: object_ref::>, - #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))] + #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))] object_mut: object_mut::>, object_boxed: object_boxed::>, object_downcast: object_downcast::, @@ -149,7 +147,7 @@ impl Error { let vtable = &ErrorVTable { object_drop: object_drop::>, object_ref: object_ref::>, - #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))] + #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))] object_mut: object_mut::>, object_boxed: object_boxed::>, object_downcast: object_downcast::, @@ -168,7 +166,7 @@ impl Error { unsafe { Error::construct(error, vtable, backtrace) } } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[cold] pub(crate) fn from_context(context: C, error: E, backtrace: Option) -> Self where @@ -198,7 +196,7 @@ impl Error { unsafe { Error::construct(error, vtable, backtrace) } } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[cold] pub(crate) fn from_boxed( error: Box, @@ -325,7 +323,7 @@ impl Error { let vtable = &ErrorVTable { object_drop: object_drop::>, object_ref: object_ref::>, - #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))] + #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))] object_mut: object_mut::>, object_boxed: object_boxed::>, object_downcast: context_chain_downcast::, @@ -399,8 +397,7 @@ impl Error { /// None /// } /// ``` - #[cfg(feature = "std")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[cold] pub fn chain(&self) -> Chain { unsafe { ErrorImpl::chain(self.inner.by_ref()) } @@ -411,8 +408,7 @@ impl Error { /// /// The root cause is the last error in the iterator produced by /// [`chain()`][Error::chain]. - #[cfg(feature = "std")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] pub fn root_cause(&self) -> &(dyn StdError + 'static) { self.chain().last().unwrap() } @@ -554,8 +550,7 @@ impl Error { } } -#[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl From for Error where E: StdError + Send + Sync + 'static, @@ -567,8 +562,7 @@ where } } -#[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl Deref for Error { type Target = dyn StdError + Send + Sync + 'static; @@ -577,8 +571,7 @@ impl Deref for Error { } } -#[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl DerefMut for Error { fn deref_mut(&mut self) -> &mut Self::Target { unsafe { ErrorImpl::error_mut(self.inner.by_mut()) } @@ -609,7 +602,7 @@ impl Drop for Error { struct ErrorVTable { object_drop: unsafe fn(Own), object_ref: unsafe fn(Ref) -> Ref, - #[cfg(all(feature = "std", anyhow_no_ptr_addr_of))] + #[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))] object_mut: unsafe fn(Mut) -> &mut (dyn StdError + Send + Sync + 'static), object_boxed: unsafe fn(Own) -> Box, object_downcast: unsafe fn(Ref, TypeId) -> Option>, @@ -661,7 +654,7 @@ where // Safety: requires layout of *e to match ErrorImpl, and for `e` to be derived // from a `&mut` -#[cfg(all(feature = "std", anyhow_no_ptr_addr_of))] +#[cfg(all(any(feature = "std", not(anyhow_no_core_error)), anyhow_no_ptr_addr_of))] unsafe fn object_mut(e: Mut) -> &mut (dyn StdError + Send + Sync + 'static) where E: StdError + Send + Sync + 'static, @@ -734,7 +727,7 @@ fn no_backtrace(e: Ref) -> Option<&Backtrace> { } // Safety: requires layout of *e to match ErrorImpl>. -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] unsafe fn context_downcast(e: Ref, target: TypeId) -> Option> where C: 'static, @@ -774,7 +767,7 @@ where } // Safety: requires layout of *e to match ErrorImpl>. -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] unsafe fn context_drop_rest(e: Own, target: TypeId) where C: 'static, @@ -906,7 +899,7 @@ impl ErrorImpl { unsafe { (vtable(this.ptr).object_ref)(this).deref() } } - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] pub(crate) unsafe fn error_mut(this: Mut) -> &mut (dyn StdError + Send + Sync + 'static) { // Use vtable to attach E's native StdError vtable for the right // original type E. @@ -1009,14 +1002,14 @@ impl From for Box { } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl AsRef for Error { fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) { &**self } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl AsRef for Error { fn as_ref(&self) -> &(dyn StdError + 'static) { &**self diff --git a/src/kind.rs b/src/kind.rs index 15d9f9b..042af32 100644 --- a/src/kind.rs +++ b/src/kind.rs @@ -47,9 +47,9 @@ use crate::Error; use core::fmt::{Debug, Display}; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] use crate::StdError; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] use alloc::boxed::Box; pub struct Adhoc; @@ -96,10 +96,10 @@ impl Trait { } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] pub struct Boxed; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[doc(hidden)] pub trait BoxedKind: Sized { #[inline] @@ -108,10 +108,10 @@ pub trait BoxedKind: Sized { } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl BoxedKind for Box {} -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl Boxed { #[cold] pub fn new(self, error: Box) -> Error { diff --git a/src/lib.rs b/src/lib.rs index 3991234..c0e20f3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -206,9 +206,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.85")] +#![doc(html_root_url = "https://docs.rs/anyhow/1.0.87")] #![cfg_attr(error_generic_member_access, feature(error_generic_member_access))] -#![cfg_attr(doc_cfg, feature(doc_cfg))] #![no_std] #![deny(dead_code, unused_imports, unused_mut)] #![cfg_attr( @@ -266,13 +265,16 @@ use crate::error::ErrorImpl; use crate::ptr::Own; use core::fmt::Display; -#[cfg(not(feature = "std"))] +#[cfg(all(not(feature = "std"), anyhow_no_core_error))] use core::fmt::Debug; #[cfg(feature = "std")] use std::error::Error as StdError; -#[cfg(not(feature = "std"))] +#[cfg(not(any(feature = "std", anyhow_no_core_error)))] +use core::error::Error as StdError; + +#[cfg(all(not(feature = "std"), anyhow_no_core_error))] trait StdError: Debug + Display { fn source(&self) -> Option<&(dyn StdError + 'static)> { None @@ -407,8 +409,7 @@ pub struct Error { /// None /// } /// ``` -#[cfg(feature = "std")] -#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[derive(Clone)] pub struct Chain<'a> { state: crate::chain::ChainState<'a>, @@ -670,7 +671,7 @@ pub mod __private { #[doc(hidden)] pub use crate::kind::{AdhocKind, TraitKind}; - #[cfg(feature = "std")] + #[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[doc(hidden)] pub use crate::kind::BoxedKind; } diff --git a/src/wrapper.rs b/src/wrapper.rs index 9726ae5..6f46779 100644 --- a/src/wrapper.rs +++ b/src/wrapper.rs @@ -1,11 +1,11 @@ use crate::StdError; use core::fmt::{self, Debug, Display}; -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] use alloc::boxed::Box; #[cfg(error_generic_member_access)] -use std::error::Request; +use core::error::Request; #[repr(transparent)] pub struct MessageError(pub M); @@ -53,25 +53,25 @@ where impl StdError for DisplayError where M: Display + 'static {} -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] #[repr(transparent)] pub struct BoxedError(pub Box); -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl Debug for BoxedError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Debug::fmt(&self.0, f) } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl Display for BoxedError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { Display::fmt(&self.0, f) } } -#[cfg(feature = "std")] +#[cfg(any(feature = "std", not(anyhow_no_core_error)))] impl StdError for BoxedError { fn source(&self) -> Option<&(dyn StdError + 'static)> { self.0.source() diff --git a/tests/compiletest.rs b/tests/compiletest.rs index 7974a62..23a6a06 100644 --- a/tests/compiletest.rs +++ b/tests/compiletest.rs @@ -1,5 +1,5 @@ -#[rustversion::attr(not(nightly), ignore)] -#[cfg_attr(miri, ignore)] +#[rustversion::attr(not(nightly), ignore = "requires nightly")] +#[cfg_attr(miri, ignore = "incompatible with miri")] #[test] fn ui() { let t = trybuild::TestCases::new(); diff --git a/tests/test_backtrace.rs b/tests/test_backtrace.rs index c89559e..938c1c2 100644 --- a/tests/test_backtrace.rs +++ b/tests/test_backtrace.rs @@ -1,7 +1,7 @@ #![allow(clippy::let_underscore_untyped)] #[rustversion::not(nightly)] -#[ignore] +#[ignore = "requires nightly"] #[test] fn test_backtrace() {} diff --git a/tests/test_ensure.rs b/tests/test_ensure.rs index 96c236d..f41ad37 100644 --- a/tests/test_ensure.rs +++ b/tests/test_ensure.rs @@ -153,18 +153,18 @@ fn test_closure() { // identifier, nor as `(S + move || 1) == (1)` by misinterpreting the // closure precedence. let test = || Ok(ensure!(S + move || 1 == 1)); - assert_err(test, "Condition failed: `S + (move || 1 == 1)`"); + assert_err(test, "Condition failed: `S + move || 1 == 1`"); let test = || Ok(ensure!(S + || 1 == 1)); - assert_err(test, "Condition failed: `S + (|| 1 == 1)`"); + assert_err(test, "Condition failed: `S + || 1 == 1`"); // Must not partition as `S + ((move | ()) | 1) == 1` by treating those // pipes as bitwise-or. let test = || Ok(ensure!(S + move |()| 1 == 1)); - assert_err(test, "Condition failed: `S + (move |()| 1 == 1)`"); + assert_err(test, "Condition failed: `S + move |()| 1 == 1`"); let test = || Ok(ensure!(S + |()| 1 == 1)); - assert_err(test, "Condition failed: `S + (|()| 1 == 1)`"); + assert_err(test, "Condition failed: `S + |()| 1 == 1`"); } #[test] @@ -224,7 +224,7 @@ fn test_if() { let test = || Ok(ensure!(if let | 1 | 2 = 2 {}.t(1) == 2)); assert_err( test, - "Condition failed: `if let 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)", + "Condition failed: `if let | 1 | 2 = 2 {}.t(1) == 2` (1 vs 2)", ); } @@ -269,7 +269,7 @@ fn test_loop() { let test = || Ok(ensure!(for | _x in iter::once(0) {}.t(1) == 2)); assert_err( test, - "Condition failed: `for _x in iter::once(0) {}.t(1) == 2` (1 vs 2)", + "Condition failed: `for | _x in iter::once(0) {}.t(1) == 2` (1 vs 2)", ); #[rustfmt::skip] @@ -286,7 +286,7 @@ fn test_match() { let test = || Ok(ensure!(match 1 == 1 { true => 1, false => 0 } == 2)); assert_err( test, - "Condition failed: `match 1 == 1 { true => 1, false => 0, } == 2` (1 vs 2)", + "Condition failed: `match 1 == 1 { true => 1, false => 0 } == 2` (1 vs 2)", ); } @@ -343,7 +343,7 @@ fn test_path() { let test = || Ok(ensure!(Error::msg::<&str,>.t(1) == 2)); assert_err( test, - "Condition failed: `Error::msg::<&str>.t(1) == 2` (1 vs 2)", + "Condition failed: `Error::msg::<&str,>.t(1) == 2` (1 vs 2)", ); let test = || Ok(ensure!(Error::msg::<::Owned>.t(1) == 2)); @@ -362,7 +362,7 @@ fn test_path() { let test = || Ok(ensure!(Chain::<'static,>::new.t(1) == 2)); assert_err( test, - "Condition failed: `Chain::<'static>::new.t(1) == 2` (1 vs 2)", + "Condition failed: `Chain::<'static,>::new.t(1) == 2` (1 vs 2)", ); fn f() {} @@ -394,7 +394,7 @@ fn test_path() { #[rustfmt::skip] let test = || Ok(ensure!(E::U::>E::U)); - assert_err(test, "Condition failed: `E::U:: > E::U` (U vs U)"); + assert_err(test, "Condition failed: `E::U:: > E::U` (U vs U)"); let test = || Ok(ensure!(Generic:: != Generic)); assert_err( @@ -416,7 +416,7 @@ fn test_path() { }; assert_err( test, - "Condition failed: `Generic:: != Generic` (Generic vs Generic)", + "Condition failed: `Generic:: != Generic` (Generic vs Generic)", ); } diff --git a/tests/test_fmt.rs b/tests/test_fmt.rs index 9766d36..8206f22 100644 --- a/tests/test_fmt.rs +++ b/tests/test_fmt.rs @@ -79,7 +79,6 @@ fn test_altdisplay() { } #[test] -#[cfg_attr(not(std_backtrace), ignore)] fn test_debug() { assert_eq!(EXPECTED_DEBUG_F, format!("{:?}", f().unwrap_err())); assert_eq!(EXPECTED_DEBUG_G, format!("{:?}", g().unwrap_err()));