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
This commit is contained in:
bors 2018-10-01 00:51:19 +00:00
commit 03379648df

View File

@ -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