Skip to content

Commit ef949da

Browse files
Rollup merge of #96639 - adpaco-aws:fix-offset-from-typo, r=scottmcm
Fix typo in `offset_from` documentation Small fix for what I think is a typo in the `offset_from` documentation. Someone reading this may understand that the distance in bytes is obtained by dividing the distance by `mem::size_of::<T>()`, but here we just want to define "units of T" in terms of bytes (i.e., units of T == bytes / `mem::size_of::<T>()`).
2 parents 87ad928 + 9b36a47 commit ef949da

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/core/src/ptr/const_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ impl<T: ?Sized> *const T {
518518
}
519519

520520
/// Calculates the distance between two pointers. The returned value is in
521-
/// units of T: the distance in bytes is divided by `mem::size_of::<T>()`.
521+
/// units of T: the distance in bytes divided by `mem::size_of::<T>()`.
522522
///
523523
/// This function is the inverse of [`offset`].
524524
///

library/core/src/ptr/mut_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ impl<T: ?Sized> *mut T {
696696
}
697697

698698
/// Calculates the distance between two pointers. The returned value is in
699-
/// units of T: the distance in bytes is divided by `mem::size_of::<T>()`.
699+
/// units of T: the distance in bytes divided by `mem::size_of::<T>()`.
700700
///
701701
/// This function is the inverse of [`offset`].
702702
///

0 commit comments

Comments
 (0)