std: Explain range follows standard half-open range in offset
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
parent
ae8ab87de4
commit
074edbd89c
1 changed files with 2 additions and 1 deletions
|
|
@ -386,7 +386,8 @@ impl<T: ?Sized> *const T {
|
|||
/// * If the computed offset is non-zero, then `self` must be [derived from][crate::ptr#provenance] a pointer to some
|
||||
/// [allocated object], and the entire memory range between `self` and the result must be in
|
||||
/// bounds of that allocated object. In particular, this range must not "wrap around" the edge
|
||||
/// of the address space.
|
||||
/// of the address space. Note that "range" here refers to a half-open range as usual in Rust,
|
||||
/// i.e., `self..result` for non-negative offsets and `result..self` for negative offsets.
|
||||
///
|
||||
/// Allocated objects can never be larger than `isize::MAX` bytes, so if the computed offset
|
||||
/// stays in bounds of the allocated object, it is guaranteed to satisfy the first requirement.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue