1
Fork 0

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:
David Tolnay 2019-11-30 20:01:48 -08:00
parent c5a2a9a99c
commit 4646a88b7a
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
30 changed files with 107 additions and 200 deletions

View file

@ -98,11 +98,7 @@ pub struct Error {
pub error: io::Error,
}
impl error::Error for Error {
fn description(&self) -> &str {
self.error.description()
}
}
impl error::Error for Error {}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {