@@ -1940,32 +1940,32 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
1940
1940
/// The precise Rust aliasing rules are somewhat in flux, but the main points are not contentious:
1941
1941
///
1942
1942
/// - If you create a safe reference with lifetime `'a` (either a `&T` or `&mut T` reference), then
1943
- /// you must not access the data in any way that contradicts that reference for the remainder of
1944
- /// `'a`. For example, this means that if you take the `*mut T` from an `UnsafeCell<T>` and cast it
1945
- /// to an `&T`, then the data in `T` must remain immutable (modulo any `UnsafeCell` data found
1946
- /// within `T`, of course) until that reference's lifetime expires. Similarly, if you create a `&mut
1947
- /// T` reference that is released to safe code, then you must not access the data within the
1948
- /// `UnsafeCell` until that reference expires.
1943
+ /// you must not access the data in any way that contradicts that reference for the remainder of
1944
+ /// `'a`. For example, this means that if you take the `*mut T` from an `UnsafeCell<T>` and cast it
1945
+ /// to an `&T`, then the data in `T` must remain immutable (modulo any `UnsafeCell` data found
1946
+ /// within `T`, of course) until that reference's lifetime expires. Similarly, if you create a
1947
+ /// `&mut T` reference that is released to safe code, then you must not access the data within the
1948
+ /// `UnsafeCell` until that reference expires.
1949
1949
///
1950
1950
/// - For both `&T` without `UnsafeCell<_>` and `&mut T`, you must also not deallocate the data
1951
- /// until the reference expires. As a special exception, given an `&T`, any part of it that is
1952
- /// inside an `UnsafeCell<_>` may be deallocated during the lifetime of the reference, after the
1953
- /// last time the reference is used (dereferenced or reborrowed). Since you cannot deallocate a part
1954
- /// of what a reference points to, this means the memory an `&T` points to can be deallocated only if
1955
- /// *every part of it* (including padding) is inside an `UnsafeCell`.
1951
+ /// until the reference expires. As a special exception, given an `&T`, any part of it that is
1952
+ /// inside an `UnsafeCell<_>` may be deallocated during the lifetime of the reference, after the
1953
+ /// last time the reference is used (dereferenced or reborrowed). Since you cannot deallocate a part
1954
+ /// of what a reference points to, this means the memory an `&T` points to can be deallocated only if
1955
+ /// *every part of it* (including padding) is inside an `UnsafeCell`.
1956
1956
///
1957
- /// However, whenever a `&UnsafeCell<T>` is constructed or dereferenced, it must still point to
1957
+ /// However, whenever a `&UnsafeCell<T>` is constructed or dereferenced, it must still point to
1958
1958
/// live memory and the compiler is allowed to insert spurious reads if it can prove that this
1959
1959
/// memory has not yet been deallocated.
1960
1960
///
1961
1961
/// To assist with proper design, the following scenarios are explicitly declared legal
1962
1962
/// for single-threaded code:
1963
1963
///
1964
1964
/// 1. A `&T` reference can be released to safe code and there it can co-exist with other `&T`
1965
- /// references, but not with a `&mut T`
1965
+ /// references, but not with a `&mut T`
1966
1966
///
1967
1967
/// 2. A `&mut T` reference may be released to safe code provided neither other `&mut T` nor `&T`
1968
- /// co-exist with it. A `&mut T` must always be unique.
1968
+ /// co-exist with it. A `&mut T` must always be unique.
1969
1969
///
1970
1970
/// Note that whilst mutating the contents of an `&UnsafeCell<T>` (even while other
1971
1971
/// `&UnsafeCell<T>` references alias the cell) is
0 commit comments