improve comment wording

This commit is contained in:
Ralf Jung 2024-05-10 16:31:57 +02:00
parent 5c33a5690d
commit 9526ce60fd
4 changed files with 16 additions and 15 deletions

View File

@ -434,7 +434,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
found_bytes: has.bytes()
},
);
// Make sure this is non-null. (ZST references can be dereferenceable and null.)
// Make sure this is non-null. We checked dereferenceability above, but if `size` is zero
// that does not imply non-null.
if self.ecx.scalar_may_be_null(Scalar::from_maybe_pointer(place.ptr(), self.ecx))? {
throw_validation_failure!(self.path, NullPtr { ptr_kind })
}

View File

@ -1484,7 +1484,7 @@ extern "rust-intrinsic" {
/// # Safety
///
/// If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of an allocated object. If either pointer is out
/// either in bounds or at the end of an allocated object. If either pointer is out
/// of bounds or arithmetic overflow occurs then any further use of the returned value will
/// result in undefined behavior.
///
@ -1502,7 +1502,7 @@ extern "rust-intrinsic" {
/// # Safety
///
/// Unlike the `offset` intrinsic, this intrinsic does not restrict the
/// resulting pointer to point into or one byte past the end of an allocated
/// resulting pointer to point into or at the end of an allocated
/// object, and it wraps with two's complement arithmetic. The resulting
/// value is not necessarily valid to be used to actually access memory.
///

View File

@ -465,8 +465,8 @@ impl<T: ?Sized> *const T {
/// If any of the following conditions are violated, the result is Undefined
/// Behavior:
///
/// * If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of the same [allocated object].
/// * If the computed offset, **in bytes**, is non-zero, then both the starting and resulting
/// pointer must be either in bounds or at the end of the same [allocated object].
/// (If it is zero, then the function is always well-defined.)
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
@ -952,8 +952,8 @@ impl<T: ?Sized> *const T {
/// If any of the following conditions are violated, the result is Undefined
/// Behavior:
///
/// * If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of the same [allocated object].
/// * If the computed offset, **in bytes**, is non-zero, then both the starting and resulting
/// pointer must be either in bounds or at the end of the same [allocated object].
/// (If it is zero, then the function is always well-defined.)
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
@ -1037,8 +1037,8 @@ impl<T: ?Sized> *const T {
/// If any of the following conditions are violated, the result is Undefined
/// Behavior:
///
/// * If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of the same [allocated object].
/// * If the computed offset, **in bytes**, is non-zero, then both the starting and resulting
/// pointer must be either in bounds or at the end of the same [allocated object].
/// (If it is zero, then the function is always well-defined.)
///
/// * The computed offset cannot exceed `isize::MAX` **bytes**.

View File

@ -480,8 +480,8 @@ impl<T: ?Sized> *mut T {
/// If any of the following conditions are violated, the result is Undefined
/// Behavior:
///
/// * If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of the same [allocated object].
/// * If the computed offset, **in bytes**, is non-zero, then both the starting and resulting
/// pointer must be either in bounds or at the end of the same [allocated object].
/// (If it is zero, then the function is always well-defined.)
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
@ -1096,8 +1096,8 @@ impl<T: ?Sized> *mut T {
/// If any of the following conditions are violated, the result is Undefined
/// Behavior:
///
/// * If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of the same [allocated object].
/// * If the computed offset, **in bytes**, is non-zero, then both the starting and resulting
/// pointer must be either in bounds or at the end of the same [allocated object].
/// (If it is zero, then the function is always well-defined.)
///
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
@ -1181,8 +1181,8 @@ impl<T: ?Sized> *mut T {
/// If any of the following conditions are violated, the result is Undefined
/// Behavior:
///
/// * If the computed offset is non-zero, then both the starting and resulting pointer must be
/// either in bounds or one byte past the end of the same [allocated object].
/// * If the computed offset, **in bytes**, is non-zero, then both the starting and resulting
/// pointer must be either in bounds or at the end of the same [allocated object].
/// (If it is zero, then the function is always well-defined.)
///
/// * The computed offset cannot exceed `isize::MAX` **bytes**.