@@ -449,6 +449,7 @@ impl<T: ?Sized> *const T {
449
449
#[ must_use = "returns a new pointer rather than modifying its argument" ]
450
450
#[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
451
451
#[ inline( always) ]
452
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
452
453
pub const unsafe fn offset ( self , count : isize ) -> * const T
453
454
where
454
455
T : Sized ,
@@ -471,6 +472,7 @@ impl<T: ?Sized> *const T {
471
472
#[ inline( always) ]
472
473
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
473
474
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
475
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
474
476
pub const unsafe fn byte_offset ( self , count : isize ) -> Self {
475
477
// SAFETY: the caller must uphold the safety contract for `offset`.
476
478
let this = unsafe { self . cast :: < u8 > ( ) . offset ( count) . cast :: < ( ) > ( ) } ;
@@ -641,6 +643,7 @@ impl<T: ?Sized> *const T {
641
643
#[ stable( feature = "ptr_offset_from" , since = "1.47.0" ) ]
642
644
#[ rustc_const_unstable( feature = "const_ptr_offset_from" , issue = "92980" ) ]
643
645
#[ inline]
646
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
644
647
pub const unsafe fn offset_from ( self , origin : * const T ) -> isize
645
648
where
646
649
T : Sized ,
@@ -663,6 +666,7 @@ impl<T: ?Sized> *const T {
663
666
#[ inline( always) ]
664
667
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
665
668
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
669
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
666
670
pub const unsafe fn byte_offset_from ( self , origin : * const T ) -> isize {
667
671
// SAFETY: the caller must uphold the safety contract for `offset_from`.
668
672
unsafe { self . cast :: < u8 > ( ) . offset_from ( origin. cast :: < u8 > ( ) ) }
@@ -731,6 +735,7 @@ impl<T: ?Sized> *const T {
731
735
#[ unstable( feature = "ptr_sub_ptr" , issue = "95892" ) ]
732
736
#[ rustc_const_unstable( feature = "const_ptr_sub_ptr" , issue = "95892" ) ]
733
737
#[ inline]
738
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
734
739
pub const unsafe fn sub_ptr ( self , origin : * const T ) -> usize
735
740
where
736
741
T : Sized ,
@@ -862,6 +867,7 @@ impl<T: ?Sized> *const T {
862
867
#[ must_use = "returns a new pointer rather than modifying its argument" ]
863
868
#[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
864
869
#[ inline( always) ]
870
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
865
871
pub const unsafe fn add ( self , count : usize ) -> Self
866
872
where
867
873
T : Sized ,
@@ -884,6 +890,7 @@ impl<T: ?Sized> *const T {
884
890
#[ inline( always) ]
885
891
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
886
892
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
893
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
887
894
pub const unsafe fn byte_add ( self , count : usize ) -> Self {
888
895
// SAFETY: the caller must uphold the safety contract for `add`.
889
896
let this = unsafe { self . cast :: < u8 > ( ) . add ( count) . cast :: < ( ) > ( ) } ;
@@ -946,6 +953,7 @@ impl<T: ?Sized> *const T {
946
953
#[ must_use = "returns a new pointer rather than modifying its argument" ]
947
954
#[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
948
955
#[ inline]
956
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
949
957
pub const unsafe fn sub ( self , count : usize ) -> Self
950
958
where
951
959
T : Sized ,
@@ -969,6 +977,7 @@ impl<T: ?Sized> *const T {
969
977
#[ inline( always) ]
970
978
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
971
979
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
980
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
972
981
pub const unsafe fn byte_sub ( self , count : usize ) -> Self {
973
982
// SAFETY: the caller must uphold the safety contract for `sub`.
974
983
let this = unsafe { self . cast :: < u8 > ( ) . sub ( count) . cast :: < ( ) > ( ) } ;
@@ -1205,6 +1214,7 @@ impl<T: ?Sized> *const T {
1205
1214
#[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
1206
1215
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1207
1216
#[ inline]
1217
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1208
1218
pub const unsafe fn copy_to ( self , dest : * mut T , count : usize )
1209
1219
where
1210
1220
T : Sized ,
@@ -1224,6 +1234,7 @@ impl<T: ?Sized> *const T {
1224
1234
#[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
1225
1235
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1226
1236
#[ inline]
1237
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1227
1238
pub const unsafe fn copy_to_nonoverlapping ( self , dest : * mut T , count : usize )
1228
1239
where
1229
1240
T : Sized ,
0 commit comments