about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-21 08:26:50 -0800
committerbors <bors@rust-lang.org>2014-02-21 08:26:50 -0800
commitf8893ed5d97180dc51d82df1bdbab989c4bde46d (patch)
tree807323b61f6b77229ade408cdb40e5ee4eece66a /src/libstd
parentc6aaf2c7bd69af2a3fc9a109a8c3a6c3004616f2 (diff)
parente2f99b93cd0f9bdbaf126ce3eb5b9a8f2be354f4 (diff)
downloadrust-f8893ed5d97180dc51d82df1bdbab989c4bde46d.tar.gz
rust-f8893ed5d97180dc51d82df1bdbab989c4bde46d.zip
auto merge of #12420 : pnkfelix/rust/fsk-improve-doc-for-ptr-offset, r=alexcrichton
ptr::RawPtr, spell out units used for the `offset` argument.

spell out units used for the `offset` argument, so that callers do not
try to scale to byte units themselves.

(this was originally landed in PR #11002 for the stand-alone functions, but that PR did not modify the `RawPtr` methods, since that had no doc at all at the time.  Now `RawPtr` has the *only* documentation for `offset`, since the stand-alone functions went away in PR #12167 / PR #12248.)
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ptr.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs
index 037984d9e7f..193e9ea7052 100644
--- a/src/libstd/ptr.rs
+++ b/src/libstd/ptr.rs
@@ -213,7 +213,8 @@ pub trait RawPtr<T> {
     /// 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;
 }