about summary refs log tree commit diff
path: root/src/libstd/sync
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2018-09-29 11:07:48 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2018-09-29 11:07:48 +0300
commitf8e9d2f0ec1bd91e099e508044981d2cd51ec5f9 (patch)
treeab8b4640efcc7cfb1c61d8a923867d78dfdfb5b0 /src/libstd/sync
parent6622172734a6c456ea85e17b765ad1dbc0e42907 (diff)
downloadrust-f8e9d2f0ec1bd91e099e508044981d2cd51ec5f9.tar.gz
rust-f8e9d2f0ec1bd91e099e508044981d2cd51ec5f9.zip
Fix Once perf regression
Because `call_once` is generic, but `is_completed` is not, we need
`#[inline]` annotation to allow LLVM to inline `is_completed` into
`call_once` in downstream crates.
Diffstat (limited to 'src/libstd/sync')
-rw-r--r--src/libstd/sync/once.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index ce54726baee..17cb614ba11 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -330,6 +330,7 @@ impl Once {
     /// assert_eq!(INIT.is_completed(), false);
     /// ```
     #[unstable(feature = "once_is_completed", issue = "42")]
+    #[inline]
     pub fn is_completed(&self) -> bool {
         // An `Acquire` load is enough because that makes all the initialization
         // operations visible to us, and, this being a fast path, weaker