@@ -465,8 +465,9 @@ impl<T: ?Sized> *const T {
465
465
/// If any of the following conditions are violated, the result is Undefined
466
466
/// Behavior:
467
467
///
468
- /// * Both the starting and resulting pointer must be either in bounds or one
469
- /// byte past the end of the same [allocated object].
468
+ /// * If the computed offset is non-zero, then both the starting and resulting pointer must be
469
+ /// either in bounds or one byte past the end of the same [allocated object].
470
+ /// (If it is zero, then the function is always well-defined.)
470
471
///
471
472
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
472
473
///
@@ -676,11 +677,11 @@ impl<T: ?Sized> *const T {
676
677
/// If any of the following conditions are violated, the result is Undefined
677
678
/// Behavior:
678
679
///
679
- /// * Both `self` and `origin` must be either in bounds or one
680
- /// byte past the end of the same [allocated object].
680
+ /// * `self` and `origin` must either
681
681
///
682
- /// * Both pointers must be *derived from* a pointer to the same object.
683
- /// (See below for an example.)
682
+ /// * both be *derived from* a pointer to the same [allocated object], and the memory range between
683
+ /// the two pointers must be either empty or in bounds of that object. (See below for an example.)
684
+ /// * or both be derived from an integer literal/constant, and point to the same address.
684
685
///
685
686
/// * The distance between the pointers, in bytes, must be an exact multiple
686
687
/// of the size of `T`.
@@ -951,8 +952,9 @@ impl<T: ?Sized> *const T {
951
952
/// If any of the following conditions are violated, the result is Undefined
952
953
/// Behavior:
953
954
///
954
- /// * Both the starting and resulting pointer must be either in bounds or one
955
- /// byte past the end of the same [allocated object].
955
+ /// * If the computed offset is non-zero, then both the starting and resulting pointer must be
956
+ /// either in bounds or one byte past the end of the same [allocated object].
957
+ /// (If it is zero, then the function is always well-defined.)
956
958
///
957
959
/// * The computed offset, **in bytes**, cannot overflow an `isize`.
958
960
///
@@ -1035,8 +1037,9 @@ impl<T: ?Sized> *const T {
1035
1037
/// If any of the following conditions are violated, the result is Undefined
1036
1038
/// Behavior:
1037
1039
///
1038
- /// * Both the starting and resulting pointer must be either in bounds or one
1039
- /// byte past the end of the same [allocated object].
1040
+ /// * If the computed offset is non-zero, then both the starting and resulting pointer must be
1041
+ /// either in bounds or one byte past the end of the same [allocated object].
1042
+ /// (If it is zero, then the function is always well-defined.)
1040
1043
///
1041
1044
/// * The computed offset cannot exceed `isize::MAX` **bytes**.
1042
1045
///
0 commit comments