@@ -443,7 +443,8 @@ impl<T: ?Sized> *const T {
443443
444444 ub_checks:: assert_unsafe_precondition!(
445445 check_language_ub,
446- "ptr::offset requires the address calculation to not overflow" ,
446+ "ptr::offset requires the address calculation to not overflow \
447+ (ptr:{this:?}, count:{count}, size:{size})",
447448 (
448449 this: * const ( ) = self as * const ( ) ,
449450 count: isize = count,
@@ -789,7 +790,8 @@ impl<T: ?Sized> *const T {
789790
790791 ub_checks:: assert_unsafe_precondition!(
791792 check_language_ub,
792- "ptr::sub_ptr requires `self >= origin`" ,
793+ "ptr::sub_ptr requires `self >= origin` \
794+ (self:{this:?}, origin:{origin:?})",
793795 (
794796 this: * const ( ) = self as * const ( ) ,
795797 origin: * const ( ) = origin as * const ( ) ,
@@ -955,7 +957,8 @@ impl<T: ?Sized> *const T {
955957 #[ cfg( debug_assertions) ] // Expensive, and doesn't catch much in the wild.
956958 ub_checks:: assert_unsafe_precondition!(
957959 check_language_ub,
958- "ptr::add requires that the address calculation does not overflow" ,
960+ "ptr::add requires that the address calculation does not overflow \
961+ (self:{this:?}, count:{count}, size:{size})",
959962 (
960963 this: * const ( ) = self as * const ( ) ,
961964 count: usize = count,
@@ -1060,7 +1063,8 @@ impl<T: ?Sized> *const T {
10601063 #[ cfg( debug_assertions) ] // Expensive, and doesn't catch much in the wild.
10611064 ub_checks:: assert_unsafe_precondition!(
10621065 check_language_ub,
1063- "ptr::sub requires that the address calculation does not overflow" ,
1066+ "ptr::sub requires that the address calculation does not overflow \
1067+ (self:{this:?}, count:{count}, size:{size})",
10641068 (
10651069 this: * const ( ) = self as * const ( ) ,
10661070 count: usize = count,
0 commit comments