Skip to content

Commit 77c85e9

Browse files
committed
Remove a couple of #[doc(hidden)] pub fn and their #[feature] gates
1 parent e7acd07 commit 77c85e9

File tree

11 files changed

+48
-132
lines changed

11 files changed

+48
-132
lines changed

library/alloc/src/ffi/c_str.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -991,12 +991,6 @@ impl IntoStringError {
991991
pub fn utf8_error(&self) -> Utf8Error {
992992
self.error
993993
}
994-
995-
#[doc(hidden)]
996-
#[unstable(feature = "cstr_internals", issue = "none")]
997-
pub fn __source(&self) -> &Utf8Error {
998-
&self.error
999-
}
1000994
}
1001995

1002996
impl IntoStringError {
@@ -1141,6 +1135,6 @@ impl core::error::Error for IntoStringError {
11411135
}
11421136

11431137
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
1144-
Some(self.__source())
1138+
Some(&self.error)
11451139
}
11461140
}

library/core/src/array/mod.rs

+2-15
Original file line numberDiff line numberDiff line change
@@ -131,28 +131,15 @@ pub struct TryFromSliceError(());
131131
impl fmt::Display for TryFromSliceError {
132132
#[inline]
133133
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
134-
fmt::Display::fmt(self.__description(), f)
134+
#[allow(deprecated)]
135+
self.description().fmt(f)
135136
}
136137
}
137138

138139
#[stable(feature = "try_from", since = "1.34.0")]
139140
impl Error for TryFromSliceError {
140141
#[allow(deprecated)]
141142
fn description(&self) -> &str {
142-
self.__description()
143-
}
144-
}
145-
146-
impl TryFromSliceError {
147-
#[unstable(
148-
feature = "array_error_internals",
149-
reason = "available through Error trait and this method should not \
150-
be exposed publicly",
151-
issue = "none"
152-
)]
153-
#[inline]
154-
#[doc(hidden)]
155-
pub fn __description(&self) -> &str {
156143
"could not convert slice to array"
157144
}
158145
}

library/core/src/char/convert.rs

+13-15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use crate::char::TryFromCharError;
44
use crate::convert::TryFrom;
5+
use crate::error::Error;
56
use crate::fmt;
67
use crate::mem::transmute;
78
use crate::str::FromStr;
@@ -150,31 +151,28 @@ pub struct ParseCharError {
150151
kind: CharErrorKind,
151152
}
152153

153-
impl ParseCharError {
154-
#[unstable(
155-
feature = "char_error_internals",
156-
reason = "this method should not be available publicly",
157-
issue = "none"
158-
)]
159-
#[doc(hidden)]
160-
pub fn __description(&self) -> &str {
154+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
155+
enum CharErrorKind {
156+
EmptyString,
157+
TooManyChars,
158+
}
159+
160+
#[stable(feature = "char_from_str", since = "1.20.0")]
161+
impl Error for ParseCharError {
162+
#[allow(deprecated)]
163+
fn description(&self) -> &str {
161164
match self.kind {
162165
CharErrorKind::EmptyString => "cannot parse char from empty string",
163166
CharErrorKind::TooManyChars => "too many characters in string",
164167
}
165168
}
166169
}
167170

168-
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
169-
enum CharErrorKind {
170-
EmptyString,
171-
TooManyChars,
172-
}
173-
174171
#[stable(feature = "char_from_str", since = "1.20.0")]
175172
impl fmt::Display for ParseCharError {
176173
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
177-
self.__description().fmt(f)
174+
#[allow(deprecated)]
175+
self.description().fmt(f)
178176
}
179177
}
180178

library/core/src/error.rs

-16
Original file line numberDiff line numberDiff line change
@@ -486,25 +486,9 @@ impl Error for crate::char::CharTryFromError {
486486
}
487487
}
488488

489-
#[stable(feature = "char_from_str", since = "1.20.0")]
490-
impl Error for crate::char::ParseCharError {
491-
#[allow(deprecated)]
492-
fn description(&self) -> &str {
493-
self.__description()
494-
}
495-
}
496-
497489
#[stable(feature = "duration_checked_float", since = "1.66.0")]
498490
impl Error for crate::time::TryFromFloatSecsError {}
499491

500-
#[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")]
501-
impl Error for crate::ffi::FromBytesWithNulError {
502-
#[allow(deprecated)]
503-
fn description(&self) -> &str {
504-
self.__description()
505-
}
506-
}
507-
508492
#[stable(feature = "cstr_from_bytes_until_nul", since = "CURRENT_RUSTC_VERSION")]
509493
impl Error for crate::ffi::FromBytesUntilNulError {}
510494

library/core/src/ffi/c_str.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::cmp::Ordering;
2+
use crate::error::Error;
23
use crate::ffi::c_char;
34
use crate::fmt;
45
use crate::intrinsics;
@@ -129,10 +130,12 @@ impl FromBytesWithNulError {
129130
const fn not_nul_terminated() -> FromBytesWithNulError {
130131
FromBytesWithNulError { kind: FromBytesWithNulErrorKind::NotNulTerminated }
131132
}
133+
}
132134

133-
#[doc(hidden)]
134-
#[unstable(feature = "cstr_internals", issue = "none")]
135-
pub fn __description(&self) -> &str {
135+
#[stable(feature = "frombyteswithnulerror_impls", since = "1.17.0")]
136+
impl Error for FromBytesWithNulError {
137+
#[allow(deprecated)]
138+
fn description(&self) -> &str {
136139
match self.kind {
137140
FromBytesWithNulErrorKind::InteriorNul(..) => {
138141
"data provided contains an interior nul byte"
@@ -180,7 +183,7 @@ impl Default for &CStr {
180183
impl fmt::Display for FromBytesWithNulError {
181184
#[allow(deprecated, deprecated_in_future)]
182185
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
183-
f.write_str(self.__description())?;
186+
f.write_str(self.description())?;
184187
if let FromBytesWithNulErrorKind::InteriorNul(pos) = self.kind {
185188
write!(f, " at byte pos {pos}")?;
186189
}

library/core/src/num/dec2flt/mod.rs

+7-10
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
issue = "none"
7676
)]
7777

78+
use crate::error::Error;
7879
use crate::fmt;
7980
use crate::str::FromStr;
8081

@@ -182,15 +183,10 @@ enum FloatErrorKind {
182183
Invalid,
183184
}
184185

185-
impl ParseFloatError {
186-
#[unstable(
187-
feature = "int_error_internals",
188-
reason = "available through Error trait and this method should \
189-
not be exposed publicly",
190-
issue = "none"
191-
)]
192-
#[doc(hidden)]
193-
pub fn __description(&self) -> &str {
186+
#[stable(feature = "rust1", since = "1.0.0")]
187+
impl Error for ParseFloatError {
188+
#[allow(deprecated)]
189+
fn description(&self) -> &str {
194190
match self.kind {
195191
FloatErrorKind::Empty => "cannot parse float from empty string",
196192
FloatErrorKind::Invalid => "invalid float literal",
@@ -201,7 +197,8 @@ impl ParseFloatError {
201197
#[stable(feature = "rust1", since = "1.0.0")]
202198
impl fmt::Display for ParseFloatError {
203199
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
204-
self.__description().fmt(f)
200+
#[allow(deprecated)]
201+
self.description().fmt(f)
205202
}
206203
}
207204

library/core/src/num/error.rs

+18-39
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,19 @@ use crate::fmt;
99
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
1010
pub struct TryFromIntError(pub(crate) ());
1111

12-
impl TryFromIntError {
13-
#[unstable(
14-
feature = "int_error_internals",
15-
reason = "available through Error trait and this method should \
16-
not be exposed publicly",
17-
issue = "none"
18-
)]
19-
#[doc(hidden)]
20-
pub fn __description(&self) -> &str {
21-
"out of range integral type conversion attempted"
12+
#[stable(feature = "try_from", since = "1.34.0")]
13+
impl fmt::Display for TryFromIntError {
14+
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
15+
#[allow(deprecated)]
16+
self.description().fmt(fmt)
2217
}
2318
}
2419

2520
#[stable(feature = "try_from", since = "1.34.0")]
26-
impl fmt::Display for TryFromIntError {
27-
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
28-
self.__description().fmt(fmt)
21+
impl Error for TryFromIntError {
22+
#[allow(deprecated)]
23+
fn description(&self) -> &str {
24+
"out of range integral type conversion attempted"
2925
}
3026
}
3127

@@ -121,43 +117,26 @@ impl ParseIntError {
121117
pub fn kind(&self) -> &IntErrorKind {
122118
&self.kind
123119
}
124-
#[unstable(
125-
feature = "int_error_internals",
126-
reason = "available through Error trait and this method should \
127-
not be exposed publicly",
128-
issue = "none"
129-
)]
130-
#[doc(hidden)]
131-
pub fn __description(&self) -> &str {
132-
match self.kind {
133-
IntErrorKind::Empty => "cannot parse integer from empty string",
134-
IntErrorKind::InvalidDigit => "invalid digit found in string",
135-
IntErrorKind::PosOverflow => "number too large to fit in target type",
136-
IntErrorKind::NegOverflow => "number too small to fit in target type",
137-
IntErrorKind::Zero => "number would be zero for non-zero type",
138-
}
139-
}
140120
}
141121

142122
#[stable(feature = "rust1", since = "1.0.0")]
143123
impl fmt::Display for ParseIntError {
144124
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
145-
self.__description().fmt(f)
125+
#[allow(deprecated)]
126+
self.description().fmt(f)
146127
}
147128
}
148129

149130
#[stable(feature = "rust1", since = "1.0.0")]
150131
impl Error for ParseIntError {
151132
#[allow(deprecated)]
152133
fn description(&self) -> &str {
153-
self.__description()
154-
}
155-
}
156-
157-
#[stable(feature = "try_from", since = "1.34.0")]
158-
impl Error for TryFromIntError {
159-
#[allow(deprecated)]
160-
fn description(&self) -> &str {
161-
self.__description()
134+
match self.kind {
135+
IntErrorKind::Empty => "cannot parse integer from empty string",
136+
IntErrorKind::InvalidDigit => "invalid digit found in string",
137+
IntErrorKind::PosOverflow => "number too large to fit in target type",
138+
IntErrorKind::NegOverflow => "number too small to fit in target type",
139+
IntErrorKind::Zero => "number would be zero for non-zero type",
140+
}
162141
}
163142
}

library/core/src/num/mod.rs

-12
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ use crate::mem;
99
use crate::ops::{Add, Mul, Sub};
1010
use crate::str::FromStr;
1111

12-
#[cfg(not(no_fp_fmt_parse))]
13-
use crate::error::Error;
14-
1512
// Used because the `?` operator is not allowed in a const context.
1613
macro_rules! try_opt {
1714
($e:expr) => {
@@ -61,15 +58,6 @@ pub use wrapping::Wrapping;
6158
#[cfg(not(no_fp_fmt_parse))]
6259
pub use dec2flt::ParseFloatError;
6360

64-
#[cfg(not(no_fp_fmt_parse))]
65-
#[stable(feature = "rust1", since = "1.0.0")]
66-
impl Error for ParseFloatError {
67-
#[allow(deprecated)]
68-
fn description(&self) -> &str {
69-
self.__description()
70-
}
71-
}
72-
7361
#[stable(feature = "rust1", since = "1.0.0")]
7462
pub use error::ParseIntError;
7563

library/std/src/lib.rs

-4
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,9 @@
273273
#![feature(utf8_chunks)]
274274
//
275275
// Library features (core):
276-
#![feature(array_error_internals)]
277276
#![feature(atomic_mut_ptr)]
278-
#![feature(char_error_internals)]
279277
#![feature(char_internals)]
280278
#![feature(core_intrinsics)]
281-
#![feature(cstr_internals)]
282279
#![feature(duration_constants)]
283280
#![feature(error_generic_member_access)]
284281
#![feature(error_in_core)]
@@ -290,7 +287,6 @@
290287
#![feature(float_next_up_down)]
291288
#![feature(hasher_prefixfree_extras)]
292289
#![feature(hashmap_internals)]
293-
#![feature(int_error_internals)]
294290
#![feature(is_some_and)]
295291
#![feature(maybe_uninit_slice)]
296292
#![feature(maybe_uninit_write_slice)]

src/doc/unstable-book/src/library-features/char-error-internals.md

-5
This file was deleted.

src/doc/unstable-book/src/library-features/int-error-internals.md

-5
This file was deleted.

0 commit comments

Comments
 (0)