File tree 2 files changed +23
-0
lines changed
2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,21 @@ unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
63
63
#[ derive( Debug , Copy , Clone ) ]
64
64
pub struct TryFromSliceError ( ( ) ) ;
65
65
66
+ impl fmt:: Display for TryFromSliceError {
67
+ #[ inline]
68
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
69
+ fmt:: Display :: fmt ( self . __description ( ) )
70
+ }
71
+ }
72
+
73
+ impl TryFromSliceError {
74
+ #[ inline]
75
+ #[ doc( hidden) ]
76
+ pub fn __description ( & self ) -> & str {
77
+ "could not convert slice to array"
78
+ }
79
+ }
80
+
66
81
macro_rules! __impl_slice_eq1 {
67
82
( $Lhs: ty, $Rhs: ty) => {
68
83
__impl_slice_eq1! { $Lhs, $Rhs, Sized }
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ use any::TypeId;
56
56
use borrow:: Cow ;
57
57
use cell;
58
58
use char;
59
+ use core:: array;
59
60
use fmt:: { self , Debug , Display } ;
60
61
use mem:: transmute;
61
62
use num;
@@ -281,6 +282,13 @@ impl Error for num::TryFromIntError {
281
282
}
282
283
}
283
284
285
+ #[ unstable( feature = "try_from" , issue = "33417" ) ]
286
+ impl Error for array:: TryFromSliceError {
287
+ fn description ( & self ) -> & str {
288
+ self . __description ( )
289
+ }
290
+ }
291
+
284
292
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
285
293
impl Error for num:: ParseFloatError {
286
294
fn description ( & self ) -> & str {
You can’t perform that action at this time.
0 commit comments