]> git.lizzy.rs Git - rust.git/commitdiff
Fixes #81109 - Typo in pointer::wrapping_sub
authorsoniasingla <soniasingla.1812@gmail.com>
Mon, 18 Jan 2021 15:01:47 +0000 (20:31 +0530)
committersoniasingla <soniasingla.1812@gmail.com>
Mon, 18 Jan 2021 15:01:47 +0000 (20:31 +0530)
Signed-off-by: soniasingla <soniasingla.1812@gmail.com>
library/core/src/ptr/const_ptr.rs
library/core/src/ptr/mut_ptr.rs

index 663001167865aaf90f0e550a96ea2ec7a271974e..28de28c70e4b44883c2505052b638ba741201d57 100644 (file)
@@ -633,7 +633,7 @@ pub const fn wrapping_add(self, count: usize) -> Self
     }
 
     /// Calculates the offset from a pointer using wrapping arithmetic.
-    /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`)
+    /// (convenience for `.wrapping_offset((count as isize).wrapping_neg())`)
     ///
     /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.
index 785bf70c2992c4395fd2242933ee4c18d81beac4..99744fc7112165711a418af92a38521a9d0c7345 100644 (file)
@@ -740,7 +740,7 @@ pub const fn wrapping_add(self, count: usize) -> Self
     }
 
     /// Calculates the offset from a pointer using wrapping arithmetic.
-    /// (convenience for `.wrapping_offset((count as isize).wrapping_sub())`)
+    /// (convenience for `.wrapping_offset((count as isize).wrapping_neg())`)
     ///
     /// `count` is in units of T; e.g., a `count` of 3 represents a pointer
     /// offset of `3 * size_of::<T>()` bytes.