diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2018-10-15 10:15:19 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-15 10:15:19 -0700 |
| commit | 8e42f01f43371c3305af6897e872d51f950d571b (patch) | |
| tree | 79c0ad4f69832de5c18f2a88707c9678adb421d2 | |
| parent | 2e8b61dce6b2dfd96575183cfdc9be03fdf21a53 (diff) | |
| parent | 6cc84acc60c21389107dac5f9dd70f08862519fd (diff) | |
| download | rust-8e42f01f43371c3305af6897e872d51f950d571b.tar.gz rust-8e42f01f43371c3305af6897e872d51f950d571b.zip | |
Rollup merge of #55060 - jannic:patch-1, r=joshtriplett
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.
I did not copy the whole explanation ("In particular, the resulting pointer may *not* be used to access a different allocated object [...]") because I'd consider that as being too repetitive. The documentation of add/sub already refers to the offset function, so people interested in the details can look it up, there.
But changing 'an object' to 'the same object' is a small change which improves clarity a lot.
| -rw-r--r-- | src/libcore/ptr.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index b8d7fcffbcc..1c761ba21b3 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -1037,7 +1037,7 @@ impl<T: ?Sized> *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`. /// @@ -1255,7 +1255,7 @@ impl<T: ?Sized> *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<T: ?Sized> *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**. /// @@ -1657,7 +1657,7 @@ impl<T: ?Sized> *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`. /// @@ -1893,7 +1893,7 @@ impl<T: ?Sized> *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<T: ?Sized> *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**. /// |
