@@ -449,6 +449,7 @@ impl<T: ?Sized> *const T {
449449 #[ must_use = "returns a new pointer rather than modifying its argument" ]
450450 #[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
451451 #[ inline( always) ]
452+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
452453 pub const unsafe fn offset ( self , count : isize ) -> * const T
453454 where
454455 T : Sized ,
@@ -471,6 +472,7 @@ impl<T: ?Sized> *const T {
471472 #[ inline( always) ]
472473 #[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
473474 #[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
475+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
474476 pub const unsafe fn byte_offset ( self , count : isize ) -> Self {
475477 // SAFETY: the caller must uphold the safety contract for `offset`.
476478 let this = unsafe { self . cast :: < u8 > ( ) . offset ( count) . cast :: < ( ) > ( ) } ;
@@ -641,6 +643,7 @@ impl<T: ?Sized> *const T {
641643 #[ stable( feature = "ptr_offset_from" , since = "1.47.0" ) ]
642644 #[ rustc_const_unstable( feature = "const_ptr_offset_from" , issue = "92980" ) ]
643645 #[ inline]
646+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
644647 pub const unsafe fn offset_from ( self , origin : * const T ) -> isize
645648 where
646649 T : Sized ,
@@ -663,6 +666,7 @@ impl<T: ?Sized> *const T {
663666 #[ inline( always) ]
664667 #[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
665668 #[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
669+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
666670 pub const unsafe fn byte_offset_from ( self , origin : * const T ) -> isize {
667671 // SAFETY: the caller must uphold the safety contract for `offset_from`.
668672 unsafe { self . cast :: < u8 > ( ) . offset_from ( origin. cast :: < u8 > ( ) ) }
@@ -731,6 +735,7 @@ impl<T: ?Sized> *const T {
731735 #[ unstable( feature = "ptr_sub_ptr" , issue = "95892" ) ]
732736 #[ rustc_const_unstable( feature = "const_ptr_sub_ptr" , issue = "95892" ) ]
733737 #[ inline]
738+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
734739 pub const unsafe fn sub_ptr ( self , origin : * const T ) -> usize
735740 where
736741 T : Sized ,
@@ -862,6 +867,7 @@ impl<T: ?Sized> *const T {
862867 #[ must_use = "returns a new pointer rather than modifying its argument" ]
863868 #[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
864869 #[ inline( always) ]
870+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
865871 pub const unsafe fn add ( self , count : usize ) -> Self
866872 where
867873 T : Sized ,
@@ -884,6 +890,7 @@ impl<T: ?Sized> *const T {
884890 #[ inline( always) ]
885891 #[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
886892 #[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
893+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
887894 pub const unsafe fn byte_add ( self , count : usize ) -> Self {
888895 // SAFETY: the caller must uphold the safety contract for `add`.
889896 let this = unsafe { self . cast :: < u8 > ( ) . add ( count) . cast :: < ( ) > ( ) } ;
@@ -946,6 +953,7 @@ impl<T: ?Sized> *const T {
946953 #[ must_use = "returns a new pointer rather than modifying its argument" ]
947954 #[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
948955 #[ inline]
956+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
949957 pub const unsafe fn sub ( self , count : usize ) -> Self
950958 where
951959 T : Sized ,
@@ -969,6 +977,7 @@ impl<T: ?Sized> *const T {
969977 #[ inline( always) ]
970978 #[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
971979 #[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
980+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
972981 pub const unsafe fn byte_sub ( self , count : usize ) -> Self {
973982 // SAFETY: the caller must uphold the safety contract for `sub`.
974983 let this = unsafe { self . cast :: < u8 > ( ) . sub ( count) . cast :: < ( ) > ( ) } ;
@@ -1205,6 +1214,7 @@ impl<T: ?Sized> *const T {
12051214 #[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
12061215 #[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
12071216 #[ inline]
1217+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
12081218 pub const unsafe fn copy_to ( self , dest : * mut T , count : usize )
12091219 where
12101220 T : Sized ,
@@ -1224,6 +1234,7 @@ impl<T: ?Sized> *const T {
12241234 #[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
12251235 #[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
12261236 #[ inline]
1237+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
12271238 pub const unsafe fn copy_to_nonoverlapping ( self , dest : * mut T , count : usize )
12281239 where
12291240 T : Sized ,
0 commit comments