Skip to content

Commit e2f99b9

Browse files
committed
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.
1 parent 882c25f commit e2f99b9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libstd/ptr.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ pub trait RawPtr<T> {
213213
/// be pointing to invalid memory.
214214
unsafe fn to_option(&self) -> Option<&T>;
215215
/// Calculates the offset from a pointer. The offset *must* be in-bounds of
216-
/// the object, or one-byte-past-the-end.
216+
/// the object, or one-byte-past-the-end. `count` is in units of T; e.g. a
217+
/// `count` of 3 represents a pointer offset of `3 * sizeof::<T>()` bytes.
217218
unsafe fn offset(self, count: int) -> Self;
218219
}
219220

0 commit comments

Comments
 (0)