about summary refs log tree commit diff
path: root/src/libcore/ptr
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-08-05 18:38:10 +0200
committerRalf Jung <post@ralfj.de>2019-08-05 18:38:10 +0200
commit1f018636e35018bbd3f83de8da68ec50669cd646 (patch)
treec25fdbc8b69c92a6c556690f869301ec8260f6d9 /src/libcore/ptr
parent4be067558962c004b638e4c6f162d50f7c0c98b6 (diff)
downloadrust-1f018636e35018bbd3f83de8da68ec50669cd646.tar.gz
rust-1f018636e35018bbd3f83de8da68ec50669cd646.zip
improve align_offset docs
Diffstat (limited to 'src/libcore/ptr')
-rw-r--r--src/libcore/ptr/mod.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libcore/ptr/mod.rs b/src/libcore/ptr/mod.rs
index 0ec4dd47b1f..fa55bbf9c16 100644
--- a/src/libcore/ptr/mod.rs
+++ b/src/libcore/ptr/mod.rs
@@ -1606,10 +1606,12 @@ impl<T: ?Sized> *const T {
     /// `align`.
     ///
     /// If it is not possible to align the pointer, the implementation returns
-    /// `usize::max_value()`.
+    /// `usize::max_value()`. It is permissible for the implementation to *always*
+    /// return `usize::max_value()`. Only your algorithm's performance can depend
+    /// on getting a usable offset here, not its correctness.
     ///
     /// The offset is expressed in number of `T` elements, and not bytes. The value returned can be
-    /// used with the `add` method.
+    /// used with the `wrapping_add` method.
     ///
     /// There are no guarantees whatsoever that offsetting the pointer will not overflow or go
     /// beyond the allocation that the pointer points into. It is up to the caller to ensure that
@@ -2407,10 +2409,12 @@ impl<T: ?Sized> *mut T {
     /// `align`.
     ///
     /// If it is not possible to align the pointer, the implementation returns
-    /// `usize::max_value()`.
+    /// `usize::max_value()`. It is permissible for the implementation to *always*
+    /// return `usize::max_value()`. Only your algorithm's performance can depend
+    /// on getting a usable offset here, not its correctness.
     ///
     /// The offset is expressed in number of `T` elements, and not bytes. The value returned can be
-    /// used with the `add` method.
+    /// used with the `wrapping_add` method.
     ///
     /// There are no guarantees whatsoever that offsetting the pointer will not overflow or go
     /// beyond the allocation that the pointer points into. It is up to the caller to ensure that