@@ -1914,6 +1914,8 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
1914
1914
/// [`.get()`]: `UnsafeCell::get`
1915
1915
/// [concurrent memory model]: ../sync/atomic/index.html#memory-model-for-atomic-accesses
1916
1916
///
1917
+ /// # Aliasing rules
1918
+ ///
1917
1919
/// The precise Rust aliasing rules are somewhat in flux, but the main points are not contentious:
1918
1920
///
1919
1921
/// - If you create a safe reference with lifetime `'a` (either a `&T` or `&mut T` reference), then
@@ -2167,10 +2169,9 @@ impl<T: ?Sized> UnsafeCell<T> {
2167
2169
2168
2170
/// Gets a mutable pointer to the wrapped value.
2169
2171
///
2170
- /// This can be cast to a pointer of any kind.
2171
- /// Ensure that the access is unique (no active references, mutable or not)
2172
- /// when casting to `&mut T`, and ensure that there are no mutations
2173
- /// or mutable aliases going on when casting to `&T`.
2172
+ /// This can be cast to a pointer of any kind. When creating references, you must uphold the
2173
+ /// aliasing rules; see [the type-level docs][UnsafeCell#aliasing-rules] for more discussion and
2174
+ /// caveats.
2174
2175
///
2175
2176
/// # Examples
2176
2177
///
@@ -2219,10 +2220,9 @@ impl<T: ?Sized> UnsafeCell<T> {
2219
2220
/// The difference from [`get`] is that this function accepts a raw pointer,
2220
2221
/// which is useful to avoid the creation of temporary references.
2221
2222
///
2222
- /// The result can be cast to a pointer of any kind.
2223
- /// Ensure that the access is unique (no active references, mutable or not)
2224
- /// when casting to `&mut T`, and ensure that there are no mutations
2225
- /// or mutable aliases going on when casting to `&T`.
2223
+ /// This can be cast to a pointer of any kind. When creating references, you must uphold the
2224
+ /// aliasing rules; see [the type-level docs][UnsafeCell#aliasing-rules] for more discussion and
2225
+ /// caveats.
2226
2226
///
2227
2227
/// [`get`]: UnsafeCell::get()
2228
2228
///
0 commit comments