diff options
| author | bors <bors@rust-lang.org> | 2019-05-11 19:13:12 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-11 19:13:12 +0000 |
| commit | af98304b9a006e2f9a367b1f79dd7655f243c150 (patch) | |
| tree | a50686fc5934f7915345ae9fc468e56535cd4b27 /src/libcore/array.rs | |
| parent | 3103fb2f72ad0443a354d4b6f5966645b5f85885 (diff) | |
| parent | 24d89e5016d269637712e9b3806f07234d59a650 (diff) | |
| download | rust-af98304b9a006e2f9a367b1f79dd7655f243c150.tar.gz rust-af98304b9a006e2f9a367b1f79dd7655f243c150.zip | |
Auto merge of #60318 - jethrogb:jb/try-from-slice-to-infallible, r=sfackler
impl From<Infallible> for TryFromSliceError I believe this was missed when TryFrom was stabilized. I think `TryFromSliceError` and `TryFromIntError` are the only two `TryFrom` error types that appear in `std`. I think trait implementations have to be insta-stable, but I'm not sure.
Diffstat (limited to 'src/libcore/array.rs')
| -rw-r--r-- | src/libcore/array.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libcore/array.rs b/src/libcore/array.rs index e4cadcbf75b..03094bfd333 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -8,7 +8,7 @@ use crate::borrow::{Borrow, BorrowMut}; use crate::cmp::Ordering; -use crate::convert::TryFrom; +use crate::convert::{Infallible, TryFrom}; use crate::fmt; use crate::hash::{Hash, self}; use crate::marker::Unsize; @@ -74,6 +74,13 @@ impl TryFromSliceError { } } +#[stable(feature = "try_from_slice_error", since = "1.36.0")] +impl From<Infallible> for TryFromSliceError { + fn from(x: Infallible) -> TryFromSliceError { + match x {} + } +} + macro_rules! __impl_slice_eq1 { ($Lhs: ty, $Rhs: ty) => { __impl_slice_eq1! { $Lhs, $Rhs, Sized } |
