Skip to content

Commit

Permalink
Auto merge of #60318 - jethrogb:jb/try-from-slice-to-infallible, r=sf…
Browse files Browse the repository at this point in the history
…ackler

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.
  • Loading branch information
bors committed May 11, 2019
2 parents 3103fb2 + 24d89e5 commit af98304
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 }
Expand Down

0 comments on commit af98304

Please sign in to comment.