From c5fe4709e02ff0362229e1d78fa293643f1f43ee Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Fri, 22 Dec 2023 14:02:58 -0500 Subject: [PATCH] Mirror std Error's deprecated methods on our `Error` trait Closes #425 --- src/no_std_error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/no_std_error.rs b/src/no_std_error.rs index 426e3a84..5cf916dd 100644 --- a/src/no_std_error.rs +++ b/src/no_std_error.rs @@ -3,12 +3,19 @@ use core::fmt::{Debug, Display}; pub trait Error: Debug + Display { + #[deprecated(since = "1.42.0", note = "use the Display impl or to_string()")] fn description(&self) -> &str { "description() is deprecated; use Display" } + + #[deprecated( + since = "1.33.0", + note = "replaced by Error::source, which can support downcasting" + )] fn cause(&self) -> Option<&dyn Error> { self.source() } + fn source(&self) -> Option<&(dyn Error + 'static)> { None }