]> git.lizzy.rs Git - rust.git/commitdiff
ptr::RawPtr, spell out units used for the `offset` argument.
authorFelix S. Klock II <pnkfelix@pnkfx.org>
Thu, 20 Feb 2014 13:58:46 +0000 (14:58 +0100)
committerFelix S. Klock II <pnkfelix@pnkfx.org>
Thu, 20 Feb 2014 13:58:46 +0000 (14:58 +0100)
spell out units used for the `offset` argument, so that callers do not
try to scale to byte units themselves.

src/libstd/ptr.rs

index 037984d9e7fc775d1948f38976431fcd411551ef..193e9ea7052f0cd0b48cfdfb81a1c4bc56f947ab 100644 (file)
@@ -213,7 +213,8 @@ fn is_not_null(&self) -> bool { !self.is_null() }
     /// be pointing to invalid memory.
     unsafe fn to_option(&self) -> Option<&T>;
     /// Calculates the offset from a pointer. The offset *must* be in-bounds of
-    /// the object, or one-byte-past-the-end.
+    /// the object, or one-byte-past-the-end.  `count` is in units of T; e.g. a
+    /// `count` of 3 represents a pointer offset of `3 * sizeof::<T>()` bytes.
     unsafe fn offset(self, count: int) -> Self;
 }