Inline try_from and try_into

To avoid link time dependency between core and compiler-builtins, when
using opt-level that implicitly enables -Zshare-generics.

While compiler-builtins should be compiled with -Zshare-generics
disabled, the -Zbuild-std does not ensure this at the moment.
This commit is contained in:
Tomasz Miąsko 2023-04-05 00:00:00 +00:00
parent da14081468
commit 67b4614180

View File

@ -764,6 +764,7 @@ where
{
type Error = U::Error;
#[inline]
fn try_into(self) -> Result<U, U::Error> {
U::try_from(self)
}
@ -779,6 +780,7 @@ where
{
type Error = Infallible;
#[inline]
fn try_from(value: U) -> Result<Self, Self::Error> {
Ok(U::into(value))
}