rust/library/std/src/sync
Matthias Krüger 55f7571a7e
Rollup merge of #140715 - lukaslueg:oncecellsyncdocs, r=tgross35
Clarify &mut-methods' docs on sync::OnceLock

Three small changes to the docs of `sync::OnceLock`:

* The docs for `OnceLock::take()` used to [say](https://doc.rust-lang.org/std/sync/struct.OnceLock.html#method.take) "**Safety** is guaranteed by requiring a mutable reference." (emphasis mine). While technically correct, imho its not necessary to even mention safety - as opposed to unsafety - here: Safety never comes up wrt `OnceLock`, as there is (currently) no way to interact with a `OnceLock` in an unsafe way; there are no unsafe methods on `OnceLock`, so there is "safety" guarantee required anywhere. What we simply meant to say is "**Synchronization** is guaranteed...".
* I've add that phrase to the other methods of `OnceLock` which take a `&mut self`, to highlight the fact that having a `&mut OnceLock` guarantees that synchronization with other threads is not required. This is the same as with [`Mutex::get_mut()`](https://doc.rust-lang.org/std/sync/struct.Mutex.html#method.get_mut), [`Cell::get_mut()`](https://doc.rust-lang.org/std/cell/struct.Cell.html#method.get_mut), and others.
* In that spirit, the half-sentence "or being initialized" was removed from `get_mut()`, as there is no way that the `OnceLock` is being initialized while we are holding `&mut` to it. Probably a copy&paste from `.get()`
2025-06-03 07:03:42 +02:00
..
mpmc docs: fix typos 2025-05-22 22:47:36 +08:00
poison Add more docs to new data_ptr methods 2025-05-21 08:07:43 +02:00
barrier.rs Move std::sync unit tests to integration tests 2025-01-26 10:28:05 +00:00
lazy_lock.rs Rollup merge of #129334 - ChayimFriedman2:more-lazy-methods, r=Amanieu 2025-05-10 16:26:01 +02:00
mod.rs Implement UniqueArc 2025-03-22 15:14:49 +08:00
mpsc.rs Move std::sync unit tests to integration tests 2025-01-26 10:28:05 +00:00
once_lock.rs Clarify &mut-methods' docs on sync::OnceLock 2025-05-28 18:31:28 +02:00
poison.rs use generic Atomic type where possible 2025-04-27 02:18:08 +03:00
reentrant_lock.rs Add ReentrantLock::data_ptr 2025-05-21 08:07:43 +02:00