Skip to content

Commit b79b687

Browse files
committed
OnceLock: Add note about drop and statics
1 parent 1d726a2 commit b79b687

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/sync/once_lock.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ use crate::sync::Once;
1414
/// # Examples
1515
///
1616
/// Using `OnceCell` to store a function’s previously computed value (a.k.a.
17-
/// ‘lazy static’ or ‘memoizing’):
17+
/// ‘lazy static’ or ‘memoizing’). Since [`drop`] is not called for static
18+
/// items at the end of the program (see [the
19+
/// reference](https://doc.rust-lang.org/reference/destructors.html), objects
20+
/// stored using this pattern will not have their destructors called.
1821
///
1922
/// ```
2023
/// use std::collections::HashMap;

0 commit comments

Comments
 (0)