From 4646a88b7a1e68326d092b9cbbbbdd616a51077f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sat, 30 Nov 2019 20:01:48 -0800 Subject: 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. --- src/libstd/sync/mpsc/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libstd/sync') diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 2831bbcb88d..0e334c191e7 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1550,6 +1550,7 @@ impl fmt::Display for SendError { #[stable(feature = "rust1", since = "1.0.0")] impl error::Error for SendError { + #[allow(deprecated)] fn description(&self) -> &str { "sending on a closed channel" } @@ -1577,6 +1578,7 @@ impl fmt::Display for TrySendError { #[stable(feature = "rust1", since = "1.0.0")] impl error::Error for TrySendError { + #[allow(deprecated)] fn description(&self) -> &str { match *self { TrySendError::Full(..) => "sending on a full channel", @@ -1603,6 +1605,7 @@ impl fmt::Display for RecvError { #[stable(feature = "rust1", since = "1.0.0")] impl error::Error for RecvError { + #[allow(deprecated)] fn description(&self) -> &str { "receiving on a closed channel" } @@ -1620,6 +1623,7 @@ impl fmt::Display for TryRecvError { #[stable(feature = "rust1", since = "1.0.0")] impl error::Error for TryRecvError { + #[allow(deprecated)] fn description(&self) -> &str { match *self { TryRecvError::Empty => "receiving on an empty channel", @@ -1649,6 +1653,7 @@ impl fmt::Display for RecvTimeoutError { #[stable(feature = "mpsc_recv_timeout_error", since = "1.15.0")] impl error::Error for RecvTimeoutError { + #[allow(deprecated)] fn description(&self) -> &str { match *self { RecvTimeoutError::Timeout => "timed out waiting on channel", -- cgit 1.4.1-3-g733a5