@@ -9,23 +9,19 @@ use crate::fmt;
99#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
1010pub 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" ) ]
143123impl 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" ) ]
150131impl 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}
0 commit comments