Skip to content

Commit 01271a7

Browse files
committed
Rollup merge of rust-lang#21663 - tbu-:pr_doc_cell_static_safety, r=alexcrichton
It has actually been safe to put an `UnsafeCell` into a non-mutable `static` since the `const` change.
2 parents 8e9c36f + cbcb191 commit 01271a7

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

src/libcore/cell.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -592,12 +592,6 @@ impl<'b, T> DerefMut for RefMut<'b, T> {
592592
/// The `UnsafeCell<T>` type is the only legal way to obtain aliasable data that is considered
593593
/// mutable. In general, transmuting an `&T` type into an `&mut T` is considered undefined behavior.
594594
///
595-
/// Although it is possible to put an `UnsafeCell<T>` into static item, it is not permitted to take
596-
/// the address of the static item if the item is not declared as mutable. This rule exists because
597-
/// immutable static items are stored in read-only memory, and thus any attempt to mutate their
598-
/// interior can cause segfaults. Immutable static items containing `UnsafeCell<T>` instances are
599-
/// still useful as read-only initializers, however, so we do not forbid them altogether.
600-
///
601595
/// Types like `Cell<T>` and `RefCell<T>` use this type to wrap their internal data.
602596
///
603597
/// `UnsafeCell<T>` doesn't opt-out from any marker traits, instead, types with an `UnsafeCell<T>`

0 commit comments

Comments
 (0)