about summary refs log tree commit diff
path: root/library/core/src/ptr
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-09-05 20:15:01 +0200
committerGitHub <noreply@github.com>2023-09-05 20:15:01 +0200
commit14c57f1adb9b1bbd643ab20a2ec256362f145022 (patch)
tree5bc71d0555d13b73c9bf598748f157f3788b6272 /library/core/src/ptr
parentab45885dec2a6552cb060a5b7183653baaecd580 (diff)
parent4684ffaf2ac5c7bb1467baf4e7f01469488c8ef2 (diff)
downloadrust-14c57f1adb9b1bbd643ab20a2ec256362f145022.tar.gz
rust-14c57f1adb9b1bbd643ab20a2ec256362f145022.zip
Rollup merge of #114794 - RalfJung:swap-safety, r=m-ou-se
clarify safety documentation of ptr::swap and ptr::copy

Closes https://github.com/rust-lang/rust/issues/81005
Diffstat (limited to 'library/core/src/ptr')
-rw-r--r--library/core/src/ptr/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs
index 01e36044899..41e67fd8435 100644
--- a/library/core/src/ptr/mod.rs
+++ b/library/core/src/ptr/mod.rs
@@ -795,7 +795,9 @@ pub const fn slice_from_raw_parts_mut<T>(data: *mut T, len: usize) -> *mut [T] {
 ///
 /// Behavior is undefined if any of the following conditions are violated:
 ///
-/// * Both `x` and `y` must be [valid] for both reads and writes.
+/// * Both `x` and `y` must be [valid] for both reads and writes. They must remain valid even when the
+///   other pointer is written. (This means if the memory ranges overlap, the two pointers must not
+///   be subject to aliasing restrictions relative to each other.)
 ///
 /// * Both `x` and `y` must be properly aligned.
 ///