From e8ec4987a8b26ea0cca076796689d2b1c00812a5 Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Sun, 14 Oct 2018 08:06:36 +0000 Subject: [PATCH 1/2] clarify pointer add/sub function safety concerns Ralf Jung made the same changes to the offset functions' documentation in commit fb089156. As add/sub just call offset, the same limitation applies here, as well. Removed emphasis on review request by @joshtriplett --- src/libcore/ptr.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index b8d7fcffbcc09..19a4fb93c306d 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -1255,7 +1255,7 @@ impl *const T { /// Behavior: /// /// * Both the starting and resulting pointer must be either in bounds or one - /// byte past the end of an allocated object. + /// byte past the end of the same allocated object. /// /// * The computed offset, **in bytes**, cannot overflow an `isize`. /// @@ -1312,7 +1312,7 @@ impl *const T { /// Behavior: /// /// * Both the starting and resulting pointer must be either in bounds or one - /// byte past the end of an allocated object. + /// byte past the end of the same allocated object. /// /// * The computed offset cannot exceed `isize::MAX` **bytes**. /// @@ -1893,7 +1893,7 @@ impl *mut T { /// Behavior: /// /// * Both the starting and resulting pointer must be either in bounds or one - /// byte past the end of an allocated object. + /// byte past the end of the same allocated object. /// /// * The computed offset, **in bytes**, cannot overflow an `isize`. /// @@ -1950,7 +1950,7 @@ impl *mut T { /// Behavior: /// /// * Both the starting and resulting pointer must be either in bounds or one - /// byte past the end of an allocated object. + /// byte past the end of the same allocated object. /// /// * The computed offset cannot exceed `isize::MAX` **bytes**. /// From 6cc84acc60c21389107dac5f9dd70f08862519fd Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Sun, 14 Oct 2018 20:23:33 +0000 Subject: [PATCH 2/2] remove unnecessary emphasis in doc comment During review of the previous commit, @joshtriplett noticed that the emphasis on 'the same' is unnecessary. For consistency, remove it on the offset() functions, as well. --- src/libcore/ptr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 19a4fb93c306d..1c761ba21b3ec 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -1037,7 +1037,7 @@ impl *const T { /// Behavior: /// /// * Both the starting and resulting pointer must be either in bounds or one - /// byte past the end of *the same* allocated object. + /// byte past the end of the same allocated object. /// /// * The computed offset, **in bytes**, cannot overflow an `isize`. /// @@ -1657,7 +1657,7 @@ impl *mut T { /// Behavior: /// /// * Both the starting and resulting pointer must be either in bounds or one - /// byte past the end of *the same* allocated object. + /// byte past the end of the same allocated object. /// /// * The computed offset, **in bytes**, cannot overflow an `isize`. ///