Change bounds on TryFrom blanket impl to use Into instead of From

This commit is contained in:
Ozaren 2018-12-13 16:53:50 -05:00
parent f4a421ee3c
commit f8bd80a830

View file

@ -476,11 +476,11 @@ impl<T, U> TryInto<U> for T where U: TryFrom<T>
// Infallible conversions are semantically equivalent to fallible conversions
// with an uninhabited error type.
#[unstable(feature = "try_from", issue = "33417")]
impl<T, U> TryFrom<U> for T where T: From<U> {
impl<T, U> TryFrom<U> for T where U: Into<T> {
type Error = !;
fn try_from(value: U) -> Result<Self, Self::Error> {
Ok(T::from(value))
Ok(U::into(value))
}
}