Skip to content

Commit 0337964

Browse files
committed
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
2 parents 93efd53 + f8e9d2f commit 0337964

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: src/libstd/sync/once.rs

+1
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ impl Once {
330330
/// assert_eq!(INIT.is_completed(), false);
331331
/// ```
332332
#[unstable(feature = "once_is_completed", issue = "42")]
333+
#[inline]
333334
pub fn is_completed(&self) -> bool {
334335
// An `Acquire` load is enough because that makes all the initialization
335336
// operations visible to us, and, this being a fast path, weaker

0 commit comments

Comments
 (0)