mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-01 01:23:26 +00:00
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:
parent
da14081468
commit
67b4614180
@ -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))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user