diff options
| author | bors <bors@rust-lang.org> | 2024-11-18 12:46:07 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-18 12:46:07 +0000 | 
| commit | c602e9aeaab636302d52b17da64e84044462a230 (patch) | |
| tree | 04f28fc278cc8bf2604d55d2a10ea5b08555d8fe /library/std/src | |
| parent | e83c45a98bf8c8228fb60e55a1cb75b8e69b5c1b (diff) | |
| parent | 194c76ef0a6db5f83d7bf6eef6b67a0e1f73dcc0 (diff) | |
| download | rust-c602e9aeaab636302d52b17da64e84044462a230.tar.gz rust-c602e9aeaab636302d52b17da64e84044462a230.zip | |
Auto merge of #133160 - jhpratt:rollup-wzj9q15, r=jhpratt
Rollup of 4 pull requests Successful merges: - #132934 (Overhaul the `-l` option parser (for linking to native libs)) - #133142 (rename rustc_const_stable_intrinsic -> rustc_intrinsic_const_stable_indirect) - #133145 (Document alternatives to `static mut`) - #133158 (Subtree update of `rust-analyzer`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/keyword_docs.rs | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 30d43c8bbfd..4302e24781e 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -1448,6 +1448,9 @@ mod self_upper_keyword {} /// in a multithreaded context. As such, all accesses to mutable `static`s /// require an [`unsafe`] block. /// +/// When possible, it's often better to use a non-mutable `static` with an +/// interior mutable type such as [`Mutex`], [`OnceLock`], or an [atomic]. +/// /// Despite their unsafety, mutable `static`s are necessary in many contexts: /// they can be used to represent global state shared by the whole program or in /// [`extern`] blocks to bind to variables from C libraries. @@ -1468,7 +1471,10 @@ mod self_upper_keyword {} /// [`extern`]: keyword.extern.html /// [`mut`]: keyword.mut.html /// [`unsafe`]: keyword.unsafe.html +/// [`Mutex`]: sync::Mutex +/// [`OnceLock`]: sync::OnceLock /// [`RefCell`]: cell::RefCell +/// [atomic]: sync::atomic /// [Reference]: ../reference/items/static-items.html mod static_keyword {} | 
