mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00: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:
commit
03379648df
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user