about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-31 23:20:13 +0200
committerGitHub <noreply@github.com>2024-07-31 23:20:13 +0200
commit7060a2f356ecb3bbe53950999ce08ab76e36b4bb (patch)
treeab1c4ab1e75b07b8fd366651ef1e4c53541510e3
parentb22c48ed6ece1064d8f27da14cd27ed58d77086b (diff)
parent83fb140ec109013b299fb400d71ac2894c962cc4 (diff)
Rollup merge of #128457 - juntyr:once-lock-docs, r=tgross35
Fix docs for OnceLock::get_mut_or_init

Removes an incorrect statment about concurrency from the `OnceLock::get_mut_or_init` (tracked in #121641) docs.

Fixes #128429
-rw-r--r--library/std/src/sync/once_lock.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/sync/once_lock.rs b/library/std/src/sync/once_lock.rs
index 60e43a1cde1..f8946aa9d42 100644
--- a/library/std/src/sync/once_lock.rs
+++ b/library/std/src/sync/once_lock.rs
@@ -281,9 +281,7 @@ impl<T> OnceLock<T> {
     /// Gets the mutable reference of the contents of the cell, initializing
     /// it with `f` if the cell was empty.
     ///
-    /// Many threads may call `get_mut_or_init` concurrently with different
-    /// initializing functions, but it is guaranteed that only one function
-    /// will be executed.
+    /// This method never blocks.
     ///
     /// # Panics
     ///
@@ -373,6 +371,8 @@ impl<T> OnceLock<T> {
     /// it with `f` if the cell was empty. If the cell was empty and `f` failed,
     /// an error is returned.
     ///
+    /// This method never blocks.
+    ///
     /// # Panics
     ///
     /// If `f` panics, the panic is propagated to the caller, and