diff options
| author | David Tolnay <dtolnay@gmail.com> | 2019-11-30 20:01:48 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2019-12-24 22:39:49 -0800 |
| commit | 4646a88b7a1e68326d092b9cbbbbdd616a51077f (patch) | |
| tree | e22c490b7e63a021218a48af92bc08a6483c6a9e /src/libstd/ffi | |
| parent | c5a2a9a99c3973f77d7c86acb8ff7039c3d9c703 (diff) | |
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.
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index e4bebd0323c..d2ee65f0a74 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -878,6 +878,7 @@ impl NulError { #[stable(feature = "rust1", since = "1.0.0")] impl Error for NulError { + #[allow(deprecated)] fn description(&self) -> &str { "nul byte found in data" } @@ -903,6 +904,7 @@ impl From<NulError> for io::Error { #[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")] impl Error for FromBytesWithNulError { + #[allow(deprecated)] fn description(&self) -> &str { match self.kind { FromBytesWithNulErrorKind::InteriorNul(..) => { @@ -915,6 +917,7 @@ impl Error for FromBytesWithNulError { #[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")] impl fmt::Display for FromBytesWithNulError { + #[allow(deprecated, deprecated_in_future)] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_str(self.description())?; if let FromBytesWithNulErrorKind::InteriorNul(pos) = self.kind { @@ -943,6 +946,7 @@ impl IntoStringError { #[stable(feature = "cstring_into", since = "1.7.0")] impl Error for IntoStringError { + #[allow(deprecated)] fn description(&self) -> &str { "C string contained non-utf8 bytes" } @@ -954,6 +958,7 @@ impl Error for IntoStringError { #[stable(feature = "cstring_into", since = "1.7.0")] impl fmt::Display for IntoStringError { + #[allow(deprecated, deprecated_in_future)] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.description().fmt(f) } |
