@@ -9,23 +9,19 @@ use crate::fmt;
9
9
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
10
10
pub struct TryFromIntError ( pub ( crate ) ( ) ) ;
11
11
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)
22
17
}
23
18
}
24
19
25
20
#[ 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"
29
25
}
30
26
}
31
27
@@ -121,43 +117,26 @@ impl ParseIntError {
121
117
pub fn kind ( & self ) -> & IntErrorKind {
122
118
& self . kind
123
119
}
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
- }
140
120
}
141
121
142
122
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
143
123
impl fmt:: Display for ParseIntError {
144
124
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
145
- self . __description ( ) . fmt ( f)
125
+ #[ allow( deprecated) ]
126
+ self . description ( ) . fmt ( f)
146
127
}
147
128
}
148
129
149
130
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
150
131
impl Error for ParseIntError {
151
132
#[ allow( deprecated) ]
152
133
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
+ }
162
141
}
163
142
}
0 commit comments