Skip to content

Commit ae25c39

Browse files
committed
Update documentation of OnceLock::get_or_init.
Explicitly point out that if the function panics the init function might be called multiple times.
1 parent 7e552b4 commit ae25c39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/sync/once_lock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl<T> OnceLock<T> {
279279
///
280280
/// Many threads may call `get_or_init` concurrently with different
281281
/// initializing functions, but it is guaranteed that only one function
282-
/// will be executed.
282+
/// will be executed if the function doesn't panic.
283283
///
284284
/// # Panics
285285
///

0 commit comments

Comments
 (0)