File tree 1 file changed +3
-2
lines changed
1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1412,8 +1412,9 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
1412
1412
/// If you have a reference `&SomeStruct`, then normally in Rust all fields of `SomeStruct` are
1413
1413
/// immutable. The compiler makes optimizations based on the knowledge that `&T` is not mutably
1414
1414
/// aliased or mutated, and that `&mut T` is unique. `UnsafeCell<T>` is the only core language
1415
- /// feature to work around this restriction. All other types that allow internal mutability, such as
1416
- /// `Cell<T>` and `RefCell<T>`, use `UnsafeCell` to wrap their internal data.
1415
+ /// feature to work around the restriction that `&T` may not be mutated. All other types that
1416
+ /// allow internal mutability, such as `Cell<T>` and `RefCell<T>`, use `UnsafeCell` to wrap their
1417
+ /// internal data. There is *no* legal way to obtain aliasing `&mut`, not even with `UnsafeCell<T>`.
1417
1418
///
1418
1419
/// The `UnsafeCell` API itself is technically very simple: it gives you a raw pointer `*mut T` to
1419
1420
/// its contents. It is up to _you_ as the abstraction designer to use that raw pointer correctly.
You can’t perform that action at this time.
0 commit comments