From e2f99b93cd0f9bdbaf126ce3eb5b9a8f2be354f4 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 20 Feb 2014 14:58:46 +0100 Subject: [PATCH] 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. --- src/libstd/ptr.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index 037984d9e7fc7..193e9ea7052f0 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -213,7 +213,8 @@ pub trait RawPtr { /// 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::()` bytes. unsafe fn offset(self, count: int) -> Self; }