@@ -884,6 +884,7 @@ impl<T: ?Sized> *const T {
884884 where
885885 T : Sized ,
886886 {
887+ #[ cfg( debug_assertions) ]
887888 #[ inline]
888889 const fn runtime_add_nowrap ( this : * const ( ) , count : usize , size : usize ) -> bool {
889890 #[ inline]
@@ -902,6 +903,7 @@ impl<T: ?Sized> *const T {
902903 intrinsics:: const_eval_select ( ( this, count, size) , comptime, runtime)
903904 }
904905
906+ #[ cfg( debug_assertions) ] // Expensive, and doesn't catch much in the wild.
905907 ub_checks:: assert_unsafe_precondition!(
906908 check_language_ub,
907909 "ptr::add requires that the address calculation does not overflow" ,
@@ -987,6 +989,7 @@ impl<T: ?Sized> *const T {
987989 where
988990 T : Sized ,
989991 {
992+ #[ cfg( debug_assertions) ]
990993 #[ inline]
991994 const fn runtime_sub_nowrap ( this : * const ( ) , count : usize , size : usize ) -> bool {
992995 #[ inline]
@@ -1004,6 +1007,7 @@ impl<T: ?Sized> *const T {
10041007 intrinsics:: const_eval_select ( ( this, count, size) , comptime, runtime)
10051008 }
10061009
1010+ #[ cfg( debug_assertions) ] // Expensive, and doesn't catch much in the wild.
10071011 ub_checks:: assert_unsafe_precondition!(
10081012 check_language_ub,
10091013 "ptr::sub requires that the address calculation does not overflow" ,
0 commit comments