1
Fork 0

Rollup merge of #135556 - AeonSolstice:patch-1, r=tgross35

Clarify note in `std::sync::LazyLock` example

I doubt most people know what it means, as I did not until a week ago. In the current form, it seems like a `TODO:`.
This commit is contained in:
Matthias Krüger 2025-01-16 17:00:47 +01:00 committed by GitHub
commit dbbbed0579
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,7 +31,7 @@ union Data<T, F> {
/// ```
/// use std::sync::LazyLock;
///
/// // n.b. static items do not call [`Drop`] on program termination, so this won't be deallocated.
/// // Note: static items do not call [`Drop`] on program termination, so this won't be deallocated.
/// // this is fine, as the OS can deallocate the terminated program faster than we can free memory
/// // but tools like valgrind might report "memory leaks" as it isn't obvious this is intentional.
/// static DEEP_THOUGHT: LazyLock<String> = LazyLock::new(|| {