Skip to content

Commit af98304

Browse files
committed
Auto merge of rust-lang#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.
2 parents 3103fb2 + 24d89e5 commit af98304

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libcore/array.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use crate::borrow::{Borrow, BorrowMut};
1010
use crate::cmp::Ordering;
11-
use crate::convert::TryFrom;
11+
use crate::convert::{Infallible, TryFrom};
1212
use crate::fmt;
1313
use crate::hash::{Hash, self};
1414
use crate::marker::Unsize;
@@ -74,6 +74,13 @@ impl TryFromSliceError {
7474
}
7575
}
7676

77+
#[stable(feature = "try_from_slice_error", since = "1.36.0")]
78+
impl From<Infallible> for TryFromSliceError {
79+
fn from(x: Infallible) -> TryFromSliceError {
80+
match x {}
81+
}
82+
}
83+
7784
macro_rules! __impl_slice_eq1 {
7885
($Lhs: ty, $Rhs: ty) => {
7986
__impl_slice_eq1! { $Lhs, $Rhs, Sized }

0 commit comments

Comments
 (0)