Deprecate Error::description for real
`description` has been documented as soft-deprecated since 1.27.0 (17 months ago). There is no longer any reason to call it or implement it. This commit: - adds #[rustc_deprecated(since = "1.41.0")] to Error::description; - moves description (and cause, which is also deprecated) below the source and backtrace methods in the Error trait; - reduces documentation of description and cause to take up much less vertical real estate in rustdocs, while preserving the example that shows how to render errors without needing to call description; - removes the description function of all *currently unstable* Error impls in the standard library; - marks #[allow(deprecated)] the description function of all *stable* Error impls in the standard library; - replaces miscellaneous uses of description in example code and the compiler.
This commit is contained in:
parent
c5a2a9a99c
commit
4646a88b7a
30 changed files with 107 additions and 200 deletions
|
@ -345,11 +345,7 @@ impl fmt::Display for DecoderError {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for DecoderError {
|
||||
fn description(&self) -> &str {
|
||||
"decoder error"
|
||||
}
|
||||
}
|
||||
impl std::error::Error for DecoderError {}
|
||||
|
||||
impl fmt::Display for EncoderError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
|
@ -358,11 +354,7 @@ impl fmt::Display for EncoderError {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for EncoderError {
|
||||
fn description(&self) -> &str {
|
||||
"encoder error"
|
||||
}
|
||||
}
|
||||
impl std::error::Error for EncoderError {}
|
||||
|
||||
impl From<fmt::Error> for EncoderError {
|
||||
/// Converts a [`fmt::Error`] into `EncoderError`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue