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