diff options
| author | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-09-29 11:15:05 -0400 |
|---|---|---|
| committer | Nikolai Vazquez <nvazquez1297@gmail.com> | 2017-09-29 11:15:05 -0400 |
| commit | e45e8abec2302530d774aab1ca800081b60aa89e (patch) | |
| tree | 91f667f6c83a170f333748a4811c39ca72d3afc5 /src/libcore/array.rs | |
| parent | a6e70b5fb48ff6e0ecee12435df78ec91b91664d (diff) | |
| download | rust-e45e8abec2302530d774aab1ca800081b60aa89e.tar.gz rust-e45e8abec2302530d774aab1ca800081b60aa89e.zip | |
Implement Error trait for TryFromSliceError
Diffstat (limited to 'src/libcore/array.rs')
| -rw-r--r-- | src/libcore/array.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs index 5f222e249ea..3d13a84e232 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -63,6 +63,21 @@ unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A { #[derive(Debug, Copy, Clone)] pub struct TryFromSliceError(()); +impl fmt::Display for TryFromSliceError { + #[inline] + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(self.__description()) + } +} + +impl TryFromSliceError { + #[inline] + #[doc(hidden)] + pub fn __description(&self) -> &str { + "could not convert slice to array" + } +} + macro_rules! __impl_slice_eq1 { ($Lhs: ty, $Rhs: ty) => { __impl_slice_eq1! { $Lhs, $Rhs, Sized } |
