about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-10-01 00:51:19 +0000
committerbors <bors@rust-lang.org>2018-10-01 00:51:19 +0000
commit03379648df3e1671506918f2eb31deff7e463cc8 (patch)
tree042772408c67e85b3c795a8a070e87c935419223 /src/libstd
parent93efd533a33cd1d3700549281a522857644d6bdd (diff)
parentf8e9d2f0ec1bd91e099e508044981d2cd51ec5f9 (diff)
downloadrust-03379648df3e1671506918f2eb31deff7e463cc8.tar.gz
rust-03379648df3e1671506918f2eb31deff7e463cc8.zip
Auto merge of #54662 - matklad:once-perf, r=alexcrichton
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.

cc https://github.com/rust-lang/rust/pull/53027/files#r221418859
Diffstat (limited to 'src/libstd')
-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