about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-09-16 08:24:49 +0200
committerGitHub <noreply@github.com>2020-09-16 08:24:49 +0200
commit19a62db49217fb4d7e5df70866d61aaa85882069 (patch)
treee316903e615dd3ce756fa2e46166283abe3faa40 /library/std/src
parentfd86705a202191ab4b4c34abd38bb7ff3771014a (diff)
parenta80d39041e2d5cd58a846c9ef9e01ee9d691a7ed (diff)
downloadrust-19a62db49217fb4d7e5df70866d61aaa85882069.tar.gz
rust-19a62db49217fb4d7e5df70866d61aaa85882069.zip
Rollup merge of #76262 - howard0su:patch-1, r=cramertj
Use inline(never) instead of cold

inline(never) is better way to avoid optimizer to inline the function instead of cold.
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/thread/local.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs
index 9d8c6f1815e..60a05dc5d54 100644
--- a/library/std/src/thread/local.rs
+++ b/library/std/src/thread/local.rs
@@ -424,10 +424,9 @@ pub mod fast {
         // thread_local's, or it is being recursively initialized.
         //
         // Macos: Inlining this function can cause two `tlv_get_addr` calls to
-        // be performed for every call to `Key::get`. The #[cold] hint makes
-        // that less likely.
+        // be performed for every call to `Key::get`.
         // LLVM issue: https://bugs.llvm.org/show_bug.cgi?id=41722
-        #[cold]
+        #[inline(never)]
         unsafe fn try_initialize<F: FnOnce() -> T>(&self, init: F) -> Option<&'static T> {
             if !mem::needs_drop::<T>() || self.try_register_dtor() {
                 Some(self.inner.initialize(init))