From 30cf0e4251533e67603c755acee5b0bd56197fce Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 2 May 2019 13:36:30 +0200 Subject: [PATCH] clarify wording --- src/libcore/slice/mod.rs | 4 ++-- src/libcore/str/mod.rs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index c273153fa5ead..50d2ba0d3ef7f 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -360,8 +360,8 @@ impl [T] { /// function returns, or else it will end up pointing to garbage. /// /// The caller must also ensure that the memory the pointer (non-transitively) points to - /// is never written to (except inside an `UnsafeCell`). If you need to mutate - /// the contents of the slice, use [`as_mut_ptr`]. + /// is never written to (except inside an `UnsafeCell`) using this pointer or any pointer + /// derived from it. If you need to mutate the contents of the slice, use [`as_mut_ptr`]. /// /// Modifying the container referenced by this slice may cause its buffer /// to be reallocated, which would also make any pointers to it invalid. diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 96a5ce61ca0bc..ef4bd83cbc5a6 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2188,9 +2188,8 @@ impl str { /// [`u8`]. This pointer will be pointing to the first byte of the string /// slice. /// - /// The caller must ensure that the memory the pointer points to - /// is never written to. If you need to mutate - /// the contents of the string slice, use [`as_mut_ptr`]. + /// The caller must ensure that the returned pointer is never written to. + /// If you need to mutate the contents of the string slice, use [`as_mut_ptr`]. /// /// [`u8`]: primitive.u8.html /// [`as_mut_ptr`]: #method.as_mut_ptr