rust/library/std
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
..
benches Fix import in bench for wasm 2025-02-12 14:44:30 -08:00
src Rollup merge of #140715 - lukaslueg:oncecellsyncdocs, r=tgross35 2025-06-03 07:03:42 +02:00
tests Implement normalize lexically 2025-05-25 08:11:41 +00:00
build.rs Use feature(target_has_reliable_f16_f128) in library tests 2025-04-27 20:10:33 +00:00
Cargo.toml Update compiler-builtins to 0.1.160 2025-05-30 16:09:12 +00:00