about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2023-04-05 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2023-04-07 14:59:10 +0200
commit67b46141804132919a7976b3484cbcf6055e431e (patch)
treeeddf06941407e079512bba0cba5a719a93a3789d
parentda140814682407ee326d36f5256bc883899a7388 (diff)
downloadrust-67b46141804132919a7976b3484cbcf6055e431e.tar.gz
rust-67b46141804132919a7976b3484cbcf6055e431e.zip
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.
-rw-r--r--library/core/src/convert/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs
index 8a8d4caf96f..5888e2960bb 100644
--- a/library/core/src/convert/mod.rs
+++ b/library/core/src/convert/mod.rs
@@ -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))
     }