Skip to content

Commit

Permalink
Merge pull request #430 from shepmaster/our-error-deprecated
Browse files Browse the repository at this point in the history
Mirror std Error's deprecated methods on our `Error` trait
  • Loading branch information
shepmaster authored Dec 22, 2023
2 parents bea7f27 + c5fe470 commit c1faaa8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/no_std_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit c1faaa8

Please # to comment.