Reserving Trait Impl's In Rust
I often find myself wanting to call a function like my_usize.try_into::<u16>()
. This function (and similar) is defined in unstable rust through the TryFrom
and TryInto
traits. Unfortunately, stabilization of these traits is currently blocked by stabilization of the !
type, because we (the royal we) want to provide default implementations of TryFrom
/TryInto
that return Result<T, !>
for any types that already implement From
/Into
. If we stabilized TryFrom
/TryInto
before stabilizing the !
type, then we would have to wait and add the blanket implementation later, once !
is stable. But since trait implementation specialization is not (currently) allowed, adding the blanket implementation later would be a breaking change; any crates that implemented both Into<Foo> for Bar
and TryInto<Foo> for Bar
, for example, would no longer compile.