@@ -1914,6 +1914,8 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
19141914/// [`.get()`]: `UnsafeCell::get`
19151915/// [concurrent memory model]: ../sync/atomic/index.html#memory-model-for-atomic-accesses
19161916///
1917+ /// # Aliasing rules
1918+ ///
19171919/// The precise Rust aliasing rules are somewhat in flux, but the main points are not contentious:
19181920///
19191921/// - 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> {
21672169
21682170 /// Gets a mutable pointer to the wrapped value.
21692171 ///
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.
21742175 ///
21752176 /// # Examples
21762177 ///
@@ -2219,10 +2220,9 @@ impl<T: ?Sized> UnsafeCell<T> {
22192220 /// The difference from [`get`] is that this function accepts a raw pointer,
22202221 /// which is useful to avoid the creation of temporary references.
22212222 ///
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.
22262226 ///
22272227 /// [`get`]: UnsafeCell::get()
22282228 ///
0 commit comments