Skip to content

Commit f8e9d2f

Browse files
committed
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.
1 parent 6622172 commit f8e9d2f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)