about summary refs log tree commit diff
path: root/library
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-05-10 16:26:03 +0200
committerGitHub <noreply@github.com>2025-05-10 16:26:03 +0200
commit8186b71fb4cab730e05707c320828bce59b42939 (patch)
tree2d53c7302571a9b54f6fdf121fae3eaa507eee8e /library
parentb8c55b438dc5df5c7f8557e9b5a4f3b308abd7f8 (diff)
parentae25c39f2216ea1f6f062faac71761cd3f1bdd16 (diff)
downloadrust-8186b71fb4cab730e05707c320828bce59b42939.tar.gz
rust-8186b71fb4cab730e05707c320828bce59b42939.zip
Rollup merge of #140783 - veluca93:oncelock-docs, r=jhpratt
Update documentation of OnceLock::get_or_init.

Explicitly point out that if the function panics the init function might be called multiple times.
Diffstat (limited to 'library')
-rw-r--r--library/std/src/sync/once_lock.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sync/once_lock.rs b/library/std/src/sync/once_lock.rs
index ffb90b14695..324b5451873 100644
--- a/library/std/src/sync/once_lock.rs
+++ b/library/std/src/sync/once_lock.rs
@@ -279,7 +279,7 @@ impl<T> OnceLock<T> {
     ///
     /// Many threads may call `get_or_init` concurrently with different
     /// initializing functions, but it is guaranteed that only one function
-    /// will be executed.
+    /// will be executed if the function doesn't panic.
     ///
     /// # Panics
     ///