Skip to content

Commit 7cb9726

Browse files
authored
Rollup merge of rust-lang#144373 - hkBst:remove-deprecated-1, r=jhpratt
remove deprecated Error::description in impls [libs-api permission](rust-lang/libs-team#615 (comment)) r? `@cuviper` or `@jhpratt`
2 parents 0d4b813 + ab6fd22 commit 7cb9726

File tree

40 files changed

+88
-376
lines changed

40 files changed

+88
-376
lines changed

compiler/rustc_thread_pool/src/lib.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -787,18 +787,7 @@ impl ThreadPoolBuildError {
787787
}
788788
}
789789

790-
const GLOBAL_POOL_ALREADY_INITIALIZED: &str =
791-
"The global thread pool has already been initialized.";
792-
793790
impl Error for ThreadPoolBuildError {
794-
#[allow(deprecated)]
795-
fn description(&self) -> &str {
796-
match self.kind {
797-
ErrorKind::GlobalPoolAlreadyInitialized => GLOBAL_POOL_ALREADY_INITIALIZED,
798-
ErrorKind::IOError(ref e) => e.description(),
799-
}
800-
}
801-
802791
fn source(&self) -> Option<&(dyn Error + 'static)> {
803792
match &self.kind {
804793
ErrorKind::GlobalPoolAlreadyInitialized => None,
@@ -810,7 +799,9 @@ impl Error for ThreadPoolBuildError {
810799
impl fmt::Display for ThreadPoolBuildError {
811800
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
812801
match &self.kind {
813-
ErrorKind::GlobalPoolAlreadyInitialized => GLOBAL_POOL_ALREADY_INITIALIZED.fmt(f),
802+
ErrorKind::GlobalPoolAlreadyInitialized => {
803+
"The global thread pool has already been initialized.".fmt(f)
804+
}
814805
ErrorKind::IOError(e) => e.fmt(f),
815806
}
816807
}

library/alloc/src/boxed.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,11 +2114,6 @@ impl<F: ?Sized + Future + Unpin, A: Allocator> Future for Box<F, A> {
21142114

21152115
#[stable(feature = "box_error", since = "1.8.0")]
21162116
impl<E: Error> Error for Box<E> {
2117-
#[allow(deprecated, deprecated_in_future)]
2118-
fn description(&self) -> &str {
2119-
Error::description(&**self)
2120-
}
2121-
21222117
#[allow(deprecated)]
21232118
fn cause(&self) -> Option<&dyn Error> {
21242119
Error::cause(&**self)

library/alloc/src/boxed/convert.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,7 @@ impl<'a> From<String> for Box<dyn Error + Send + Sync + 'a> {
608608
fn from(err: String) -> Box<dyn Error + Send + Sync + 'a> {
609609
struct StringError(String);
610610

611-
impl Error for StringError {
612-
#[allow(deprecated)]
613-
fn description(&self) -> &str {
614-
&self.0
615-
}
616-
}
611+
impl Error for StringError {}
617612

618613
impl fmt::Display for StringError {
619614
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {

library/alloc/src/collections/btree/map/entry.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,6 @@ impl<'a, K: Debug + Ord, V: Debug, A: Allocator + Clone> fmt::Display
136136
impl<'a, K: core::fmt::Debug + Ord, V: core::fmt::Debug> core::error::Error
137137
for crate::collections::btree_map::OccupiedError<'a, K, V>
138138
{
139-
#[allow(deprecated)]
140-
fn description(&self) -> &str {
141-
"key already exists"
142-
}
143139
}
144140

145141
impl<'a, K: Ord, V, A: Allocator + Clone> Entry<'a, K, V, A> {

library/alloc/src/ffi/c_str.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,17 +1061,10 @@ impl IntoStringError {
10611061
}
10621062
}
10631063

1064-
impl IntoStringError {
1065-
fn description(&self) -> &str {
1066-
"C string contained non-utf8 bytes"
1067-
}
1068-
}
1069-
10701064
#[stable(feature = "cstring_into", since = "1.7.0")]
10711065
impl fmt::Display for IntoStringError {
1072-
#[allow(deprecated, deprecated_in_future)]
10731066
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1074-
self.description().fmt(f)
1067+
"C string contained non-utf8 bytes".fmt(f)
10751068
}
10761069
}
10771070

@@ -1291,23 +1284,13 @@ impl PartialEq<CString> for Cow<'_, CStr> {
12911284
}
12921285

12931286
#[stable(feature = "rust1", since = "1.0.0")]
1294-
impl core::error::Error for NulError {
1295-
#[allow(deprecated)]
1296-
fn description(&self) -> &str {
1297-
"nul byte found in data"
1298-
}
1299-
}
1287+
impl core::error::Error for NulError {}
13001288

13011289
#[stable(feature = "cstring_from_vec_with_nul", since = "1.58.0")]
13021290
impl core::error::Error for FromVecWithNulError {}
13031291

13041292
#[stable(feature = "cstring_into", since = "1.7.0")]
13051293
impl core::error::Error for IntoStringError {
1306-
#[allow(deprecated)]
1307-
fn description(&self) -> &str {
1308-
"C string contained non-utf8 bytes"
1309-
}
1310-
13111294
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
13121295
Some(&self.error)
13131296
}

library/alloc/src/string.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,20 +2285,10 @@ impl fmt::Display for FromUtf16Error {
22852285
}
22862286

22872287
#[stable(feature = "rust1", since = "1.0.0")]
2288-
impl Error for FromUtf8Error {
2289-
#[allow(deprecated)]
2290-
fn description(&self) -> &str {
2291-
"invalid utf-8"
2292-
}
2293-
}
2288+
impl Error for FromUtf8Error {}
22942289

22952290
#[stable(feature = "rust1", since = "1.0.0")]
2296-
impl Error for FromUtf16Error {
2297-
#[allow(deprecated)]
2298-
fn description(&self) -> &str {
2299-
"invalid utf-16"
2300-
}
2301-
}
2291+
impl Error for FromUtf16Error {}
23022292

23032293
#[cfg(not(no_global_oom_handling))]
23042294
#[stable(feature = "rust1", since = "1.0.0")]

library/alloc/src/sync.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,11 +4100,6 @@ impl<T: ?Sized, A: Allocator> Drop for UniqueArcUninit<T, A> {
41004100

41014101
#[stable(feature = "arc_error", since = "1.52.0")]
41024102
impl<T: core::error::Error + ?Sized> core::error::Error for Arc<T> {
4103-
#[allow(deprecated, deprecated_in_future)]
4104-
fn description(&self) -> &str {
4105-
core::error::Error::description(&**self)
4106-
}
4107-
41084103
#[allow(deprecated)]
41094104
fn cause(&self) -> Option<&dyn core::error::Error> {
41104105
core::error::Error::cause(&**self)

library/core/src/array/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,12 @@ pub struct TryFromSliceError(());
184184
impl fmt::Display for TryFromSliceError {
185185
#[inline]
186186
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
187-
#[allow(deprecated)]
188-
self.description().fmt(f)
187+
"could not convert slice to array".fmt(f)
189188
}
190189
}
191190

192191
#[stable(feature = "try_from", since = "1.34.0")]
193-
impl Error for TryFromSliceError {
194-
#[allow(deprecated)]
195-
fn description(&self) -> &str {
196-
"could not convert slice to array"
197-
}
198-
}
192+
impl Error for TryFromSliceError {}
199193

200194
#[stable(feature = "try_from_slice_error", since = "1.36.0")]
201195
#[rustc_const_unstable(feature = "const_try", issue = "74935")]

library/core/src/char/convert.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,16 @@ enum CharErrorKind {
193193
}
194194

195195
#[stable(feature = "char_from_str", since = "1.20.0")]
196-
impl Error for ParseCharError {
197-
#[allow(deprecated)]
198-
fn description(&self) -> &str {
199-
match self.kind {
200-
CharErrorKind::EmptyString => "cannot parse char from empty string",
201-
CharErrorKind::TooManyChars => "too many characters in string",
202-
}
203-
}
204-
}
196+
impl Error for ParseCharError {}
205197

206198
#[stable(feature = "char_from_str", since = "1.20.0")]
207199
impl fmt::Display for ParseCharError {
208200
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
209-
#[allow(deprecated)]
210-
self.description().fmt(f)
201+
match self.kind {
202+
CharErrorKind::EmptyString => "cannot parse char from empty string",
203+
CharErrorKind::TooManyChars => "too many characters in string",
204+
}
205+
.fmt(f)
211206
}
212207
}
213208

library/core/src/char/decode.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,4 @@ impl fmt::Display for DecodeUtf16Error {
126126
}
127127

128128
#[stable(feature = "decode_utf16", since = "1.9.0")]
129-
impl Error for DecodeUtf16Error {
130-
#[allow(deprecated)]
131-
fn description(&self) -> &str {
132-
"unpaired surrogate found"
133-
}
134-
}
129+
impl Error for DecodeUtf16Error {}

0 commit comments

Comments
 (0)