diff --git a/library/core/src/intrinsics/mod.rs b/library/core/src/intrinsics/mod.rs index c2e4b751c65f3..1ece3d9bd5e4c 100644 --- a/library/core/src/intrinsics/mod.rs +++ b/library/core/src/intrinsics/mod.rs @@ -910,7 +910,7 @@ pub const unsafe fn arith_offset(dst: *const T, offset: isize) -> *const T; /// # Safety /// /// - `index < PtrMetadata(slice_ptr)`, so the indexing is in-bounds for the slice -/// - the resulting offsetting is in-bounds of the allocated object, which is +/// - the resulting offsetting is in-bounds of the allocation, which is /// always the case for references, but needs to be upheld manually for pointers #[rustc_nounwind] #[rustc_intrinsic] diff --git a/library/core/src/ptr/docs/add.md b/library/core/src/ptr/docs/add.md index ae7c7785684c9..6e2e87f5f811b 100644 --- a/library/core/src/ptr/docs/add.md +++ b/library/core/src/ptr/docs/add.md @@ -19,7 +19,7 @@ If any of the following conditions are violated, the result is Undefined Behavio bounds of that allocation. In particular, this range must not "wrap around" the edge of the address space. -Allocated objects can never be larger than `isize::MAX` bytes, so if the computed offset +Allocations can never be larger than `isize::MAX` bytes, so if the computed offset stays in bounds of the allocation, it is guaranteed to satisfy the first requirement. This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec`) is always safe. diff --git a/library/core/src/ptr/docs/offset.md b/library/core/src/ptr/docs/offset.md index f2e335a79a5c2..f04f5606ab297 100644 --- a/library/core/src/ptr/docs/offset.md +++ b/library/core/src/ptr/docs/offset.md @@ -16,7 +16,7 @@ bounds of that allocation. In particular, this range must not "wrap around" the 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 +Allocations can never be larger than `isize::MAX` bytes, so if the computed offset stays in bounds of the allocation, it is guaranteed to satisfy the first requirement. This implies, for instance, that `vec.as_ptr().add(vec.len())` (for `vec: Vec`) is always safe.