mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
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:
@@ -330,6 +330,7 @@ pub fn call_once_force<F>(&self, f: F) where F: FnOnce(&OnceState) {
|
||||
/// 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
|
||||
|
||||
Reference in New Issue
Block a user