about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuca Versari <veluca93@gmail.com>2025-05-08 09:33:38 +0200
committerLuca Versari <veluca93@gmail.com>2025-05-08 09:33:38 +0200
commitae25c39f2216ea1f6f062faac71761cd3f1bdd16 (patch)
tree3afbe7f3579d9266c1296f35246828ee2338b024
parent7e552b46af72df390ed233b58a7f51650515b2a8 (diff)
downloadrust-ae25c39f2216ea1f6f062faac71761cd3f1bdd16.tar.gz
rust-ae25c39f2216ea1f6f062faac71761cd3f1bdd16.zip
Update documentation of OnceLock::get_or_init.
Explicitly point out that if the function panics the init function might
be called multiple times.
-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
     ///