@@ -887,6 +887,7 @@ impl<T: ?Sized> *const T {
887887 where
888888 T : Sized ,
889889 {
890+ #[ cfg( debug_assertions) ]
890891 #[ inline]
891892 const fn runtime_add_nowrap ( this : * const ( ) , count : usize , size : usize ) -> bool {
892893 #[ inline]
@@ -905,6 +906,7 @@ impl<T: ?Sized> *const T {
905906 intrinsics:: const_eval_select ( ( this, count, size) , comptime, runtime)
906907 }
907908
909+ #[ cfg( debug_assertions) ] // Expensive, and doesn't catch much in the wild.
908910 ub_checks:: assert_unsafe_precondition!(
909911 check_language_ub,
910912 "ptr::add requires that the address calculation does not overflow" ,
@@ -993,6 +995,7 @@ impl<T: ?Sized> *const T {
993995 where
994996 T : Sized ,
995997 {
998+ #[ cfg( debug_assertions) ]
996999 #[ inline]
9971000 const fn runtime_sub_nowrap ( this : * const ( ) , count : usize , size : usize ) -> bool {
9981001 #[ inline]
@@ -1010,6 +1013,7 @@ impl<T: ?Sized> *const T {
10101013 intrinsics:: const_eval_select ( ( this, count, size) , comptime, runtime)
10111014 }
10121015
1016+ #[ cfg( debug_assertions) ] // Expensive, and doesn't catch much in the wild.
10131017 ub_checks:: assert_unsafe_precondition!(
10141018 check_language_ub,
10151019 "ptr::sub requires that the address calculation does not overflow" ,
0 commit comments