Don’t use type Error = ! for target-dependant TryFrom impls.

Instead, expose apparently-fallible conversions in cases where
the implementation happens to be infallible for a given target.

Having an associated type / return type in a public API change
based on the target is a portability hazard.
This commit is contained in:
Simon Sapin 2018-03-23 13:42:43 +01:00
parent 2178ef8b22
commit 9fd399feb1

View File

@ -3681,7 +3681,7 @@ macro_rules! try_from_unbounded {
($source:ty, $($target:ty),*) => {$(
#[unstable(feature = "try_from", issue = "33417")]
impl TryFrom<$source> for $target {
type Error = !;
type Error = TryFromIntError;
#[inline]
fn try_from(value: $source) -> Result<Self, Self::Error> {