File tree 1 file changed +6
-0
lines changed
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 {}
1448
1448
/// in a multithreaded context. As such, all accesses to mutable `static`s
1449
1449
/// require an [`unsafe`] block.
1450
1450
///
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
+ ///
1451
1454
/// Despite their unsafety, mutable `static`s are necessary in many contexts:
1452
1455
/// they can be used to represent global state shared by the whole program or in
1453
1456
/// [`extern`] blocks to bind to variables from C libraries.
@@ -1468,7 +1471,10 @@ mod self_upper_keyword {}
1468
1471
/// [`extern`]: keyword.extern.html
1469
1472
/// [`mut`]: keyword.mut.html
1470
1473
/// [`unsafe`]: keyword.unsafe.html
1474
+ /// [`Mutex`]: sync::Mutex
1475
+ /// [`OnceLock`]: sync::OnceLock
1471
1476
/// [`RefCell`]: cell::RefCell
1477
+ /// [atomic]: sync::atomic
1472
1478
/// [Reference]: ../reference/items/static-items.html
1473
1479
mod static_keyword { }
1474
1480
You can’t perform that action at this time.
0 commit comments