From 2c43dd16aeefb63b6259668f058dabc4d3d49c40 Mon Sep 17 00:00:00 2001 From: MegaBluejay Date: Tue, 15 Aug 2023 15:27:56 +0300 Subject: [PATCH] Add explicit source case to forward tests --- tests/error/derives_forward.rs | 11 ++++++++--- tests/error/nightly/derives_forward.rs | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/error/derives_forward.rs b/tests/error/derives_forward.rs index d1d8a2dd..9e80a44a 100644 --- a/tests/error/derives_forward.rs +++ b/tests/error/derives_forward.rs @@ -27,8 +27,13 @@ derive_display!(EnumAttr); #[derive(Debug, Error)] #[error(forward)] enum EnumAttr { - A { source: Inner }, - B { source: Inner }, + A { + source: Inner, + }, + B { + #[error(source)] + explicit_source: Inner, + }, } #[test] @@ -38,7 +43,7 @@ fn enum_attr() { }; let err_b = EnumAttr::B { - source: Inner { source: SimpleErr }, + explicit_source: Inner { source: SimpleErr }, }; assert!(err_a.source().is_some()); diff --git a/tests/error/nightly/derives_forward.rs b/tests/error/nightly/derives_forward.rs index 591f0fe3..254bb487 100644 --- a/tests/error/nightly/derives_forward.rs +++ b/tests/error/nightly/derives_forward.rs @@ -49,8 +49,8 @@ enum EnumAttr { source: Inner, }, B { - #[error(backtrace)] - source: Inner, + #[error(source, backtrace)] + explicit_source: Inner, }, } @@ -58,7 +58,7 @@ impl EnumAttr { fn get_source_backtrace(&self) -> &Backtrace { request_ref(match self { Self::A { source } => &source.source, - Self::B { source } => &source.source, + Self::B { explicit_source } => &explicit_source.source, }) .unwrap() } @@ -74,7 +74,7 @@ fn enum_attr() { }, }; let err_b = EnumAttr::B { - source: Inner { + explicit_source: Inner { source: BacktraceErr { backtrace: Backtrace::force_capture(), },