mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
improve align_offset docs
This commit is contained in:
@@ -1606,10 +1606,12 @@ pub unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize)
|
||||
/// `align`.
|
||||
///
|
||||
/// If it is not possible to align the pointer, the implementation returns
|
||||
/// `usize::max_value()`.
|
||||
/// `usize::max_value()`. It is permissible for the implementation to *always*
|
||||
/// return `usize::max_value()`. Only your algorithm's performance can depend
|
||||
/// on getting a usable offset here, not its correctness.
|
||||
///
|
||||
/// The offset is expressed in number of `T` elements, and not bytes. The value returned can be
|
||||
/// used with the `add` method.
|
||||
/// used with the `wrapping_add` method.
|
||||
///
|
||||
/// There are no guarantees whatsoever that offsetting the pointer will not overflow or go
|
||||
/// beyond the allocation that the pointer points into. It is up to the caller to ensure that
|
||||
@@ -2407,10 +2409,12 @@ pub unsafe fn swap(self, with: *mut T)
|
||||
/// `align`.
|
||||
///
|
||||
/// If it is not possible to align the pointer, the implementation returns
|
||||
/// `usize::max_value()`.
|
||||
/// `usize::max_value()`. It is permissible for the implementation to *always*
|
||||
/// return `usize::max_value()`. Only your algorithm's performance can depend
|
||||
/// on getting a usable offset here, not its correctness.
|
||||
///
|
||||
/// The offset is expressed in number of `T` elements, and not bytes. The value returned can be
|
||||
/// used with the `add` method.
|
||||
/// used with the `wrapping_add` method.
|
||||
///
|
||||
/// There are no guarantees whatsoever that offsetting the pointer will not overflow or go
|
||||
/// beyond the allocation that the pointer points into. It is up to the caller to ensure that
|
||||
|
||||
Reference in New Issue
Block a user