OnceLock::get_mut_or_init should not be called concurrently #128429
Labels
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
C-bug
Category: This is a bug.
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Location
https://doc.rust-lang.org/std/sync/struct.OnceLock.html#method.get_mut_or_init
Summary
The current docs state that
However, as the method takes a mutable reference, no concurrent calls to this method can occur. If this method was indeed called from several threads, they would need to use external synchronisation to make the access exclusive and not-concurrent. It seems that this text was copy-pasted from the
get_or_init
sibling method.The text was updated successfully, but these errors were encountered: