File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1448,6 +1448,9 @@ mod self_upper_keyword {}
14481448/// in a multithreaded context. As such, all accesses to mutable `static`s
14491449/// require an [`unsafe`] block.
14501450///
1451+ /// When possible, it's often better to use a non-mutable `static` with an
1452+ /// interior mutable type such as [`Mutex`], [`OnceLock`], or an [atomic].
1453+ ///
14511454/// Despite their unsafety, mutable `static`s are necessary in many contexts:
14521455/// they can be used to represent global state shared by the whole program or in
14531456/// [`extern`] blocks to bind to variables from C libraries.
@@ -1468,7 +1471,10 @@ mod self_upper_keyword {}
14681471/// [`extern`]: keyword.extern.html
14691472/// [`mut`]: keyword.mut.html
14701473/// [`unsafe`]: keyword.unsafe.html
1474+ /// [`Mutex`]: sync::Mutex
1475+ /// [`OnceLock`]: sync::OnceLock
14711476/// [`RefCell`]: cell::RefCell
1477+ /// [atomic]: sync::atomic
14721478/// [Reference]: ../reference/items/static-items.html
14731479mod static_keyword { }
14741480
You can’t perform that action at this time.
0 commit comments