@@ -1164,11 +1164,12 @@ impl<'a, T: ?Sized + fmt::Display> fmt::Display for RefMut<'a, T> {
1164
1164
/// The compiler makes optimizations based on the knowledge that `&T` is not mutably aliased or
1165
1165
/// mutated, and that `&mut T` is unique. When building abstractions like `Cell`, `RefCell`,
1166
1166
/// `Mutex`, etc, you need to turn these optimizations off. `UnsafeCell` is the only legal way
1167
- /// to do this. When `UnsafeCell<T>` is immutably aliased, it is still safe to obtain a mutable
1168
- /// reference to its interior and/or to mutate it. However, it is up to the abstraction designer
1169
- /// to ensure that no two mutable references obtained this way are active at the same time, and
1170
- /// that there are no active mutable references or mutations when an immutable reference is obtained
1171
- /// from the cell. This is often done via runtime checks.
1167
+ /// to do this. When `UnsafeCell<T>` _itself_ is immutably aliased, it is still safe to obtain
1168
+ /// a mutable reference to its _interior_ and/or to mutate the interior. However, it is up to
1169
+ /// the abstraction designer to ensure that no two mutable references obtained this way are active
1170
+ /// at the same time, there are no active immutable reference when a mutable reference is obtained
1171
+ /// from the cell, and that there are no active mutable references or mutations when an immutable
1172
+ /// reference is obtained. This is often done via runtime checks.
1172
1173
///
1173
1174
/// Note that while mutating or mutably aliasing the contents of an `& UnsafeCell<T>` is
1174
1175
/// okay (provided you enforce the invariants some other way); it is still undefined behavior
@@ -1240,9 +1241,9 @@ impl<T: ?Sized> UnsafeCell<T> {
1240
1241
/// Gets a mutable pointer to the wrapped value.
1241
1242
///
1242
1243
/// This can be cast to a pointer of any kind.
1243
- /// Ensure that the access is unique when casting to
1244
- /// `&mut T`, and ensure that there are no mutations or mutable
1245
- /// aliases going on when casting to `&T`
1244
+ /// Ensure that the access is unique (no active references, mutable or not)
1245
+ /// when casting to `&mut T`, and ensure that there are no mutations
1246
+ /// or mutable aliases going on when casting to `&T`
1246
1247
///
1247
1248
/// # Examples
1248
1249
///
0 commit comments