Rollup merge of #96136 - thomcc:lifetime-wording, r=RalfJung
Reword clarification on lifetime for ptr->ref safety docs I believe the current wording of the safety comment is somewhat misleading, and that this is more accurate. Suggested by `@CAD97` in this thread on the topic https://rust-lang.zulipchat.com/#narrow/stream/136281-t-lang.2Fwg-unsafe-code-guidelines/topic/Lifetime.20of.20reference.20pointer.20docs.20issue Just to check that this is correct, CC `@RalfJung.` I suppose it's open for interpretation as to whether or not this is more clear. I think it is.
This commit is contained in:
commit
a6ad1394f3
@ -295,7 +295,7 @@ impl<T: ?Sized> *const T {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -358,7 +358,7 @@ impl<T: ?Sized> *const T {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -1188,7 +1188,7 @@ impl<T> *const [T] {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
|
@ -302,7 +302,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -368,7 +368,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -550,7 +550,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get accessed (read or written) through any other pointer.
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -615,7 +615,7 @@ impl<T: ?Sized> *mut T {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get accessed (read or written) through any other pointer.
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -1461,7 +1461,7 @@ impl<T> *mut [T] {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -1513,7 +1513,7 @@ impl<T> *mut [T] {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get accessed (read or written) through any other pointer.
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
|
@ -114,7 +114,7 @@ impl<T: Sized> NonNull<T> {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -148,7 +148,7 @@ impl<T: Sized> NonNull<T> {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get accessed (read or written) through any other pointer.
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -350,7 +350,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -400,7 +400,7 @@ impl<T: ?Sized> NonNull<T> {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get accessed (read or written) through any other pointer.
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -580,7 +580,7 @@ impl<T> NonNull<[T]> {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get mutated (except inside `UnsafeCell`).
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
@ -626,7 +626,7 @@ impl<T> NonNull<[T]> {
|
||||
///
|
||||
/// * You must enforce Rust's aliasing rules, since the returned lifetime `'a` is
|
||||
/// arbitrarily chosen and does not necessarily reflect the actual lifetime of the data.
|
||||
/// In particular, for the duration of this lifetime, the memory the pointer points to must
|
||||
/// In particular, while this reference exists, the memory the pointer points to must
|
||||
/// not get accessed (read or written) through any other pointer.
|
||||
///
|
||||
/// This applies even if the result of this method is unused!
|
||||
|
Loading…
x
Reference in New Issue
Block a user