@@ -461,6 +461,7 @@ impl<T: ?Sized> *mut T {
461
461
#[ must_use = "returns a new pointer rather than modifying its argument" ]
462
462
#[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
463
463
#[ inline( always) ]
464
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
464
465
pub const unsafe fn offset ( self , count : isize ) -> * mut T
465
466
where
466
467
T : Sized ,
@@ -485,6 +486,7 @@ impl<T: ?Sized> *mut T {
485
486
#[ inline( always) ]
486
487
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
487
488
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
489
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
488
490
pub const unsafe fn byte_offset ( self , count : isize ) -> Self {
489
491
// SAFETY: the caller must uphold the safety contract for `offset`.
490
492
let this = unsafe { self . cast :: < u8 > ( ) . offset ( count) . cast :: < ( ) > ( ) } ;
@@ -824,6 +826,7 @@ impl<T: ?Sized> *mut T {
824
826
#[ stable( feature = "ptr_offset_from" , since = "1.47.0" ) ]
825
827
#[ rustc_const_unstable( feature = "const_ptr_offset_from" , issue = "92980" ) ]
826
828
#[ inline( always) ]
829
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
827
830
pub const unsafe fn offset_from ( self , origin : * const T ) -> isize
828
831
where
829
832
T : Sized ,
@@ -844,6 +847,7 @@ impl<T: ?Sized> *mut T {
844
847
#[ inline( always) ]
845
848
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
846
849
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
850
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
847
851
pub const unsafe fn byte_offset_from ( self , origin : * const T ) -> isize {
848
852
// SAFETY: the caller must uphold the safety contract for `offset_from`.
849
853
unsafe { self . cast :: < u8 > ( ) . offset_from ( origin. cast :: < u8 > ( ) ) }
@@ -913,6 +917,7 @@ impl<T: ?Sized> *mut T {
913
917
#[ unstable( feature = "ptr_sub_ptr" , issue = "95892" ) ]
914
918
#[ rustc_const_unstable( feature = "const_ptr_sub_ptr" , issue = "95892" ) ]
915
919
#[ inline]
920
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
916
921
pub const unsafe fn sub_ptr ( self , origin : * const T ) -> usize
917
922
where
918
923
T : Sized ,
@@ -976,6 +981,7 @@ impl<T: ?Sized> *mut T {
976
981
#[ must_use = "returns a new pointer rather than modifying its argument" ]
977
982
#[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
978
983
#[ inline( always) ]
984
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
979
985
pub const unsafe fn add ( self , count : usize ) -> Self
980
986
where
981
987
T : Sized ,
@@ -998,6 +1004,7 @@ impl<T: ?Sized> *mut T {
998
1004
#[ inline( always) ]
999
1005
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
1000
1006
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
1007
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1001
1008
pub const unsafe fn byte_add ( self , count : usize ) -> Self {
1002
1009
// SAFETY: the caller must uphold the safety contract for `add`.
1003
1010
let this = unsafe { self . cast :: < u8 > ( ) . add ( count) . cast :: < ( ) > ( ) } ;
@@ -1060,6 +1067,7 @@ impl<T: ?Sized> *mut T {
1060
1067
#[ must_use = "returns a new pointer rather than modifying its argument" ]
1061
1068
#[ rustc_const_stable( feature = "const_ptr_offset" , since = "1.61.0" ) ]
1062
1069
#[ inline]
1070
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1063
1071
pub const unsafe fn sub ( self , count : usize ) -> Self
1064
1072
where
1065
1073
T : Sized ,
@@ -1083,6 +1091,7 @@ impl<T: ?Sized> *mut T {
1083
1091
#[ inline( always) ]
1084
1092
#[ unstable( feature = "pointer_byte_offsets" , issue = "96283" ) ]
1085
1093
#[ rustc_const_unstable( feature = "const_pointer_byte_offsets" , issue = "96283" ) ]
1094
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1086
1095
pub const unsafe fn byte_sub ( self , count : usize ) -> Self {
1087
1096
// SAFETY: the caller must uphold the safety contract for `sub`.
1088
1097
let this = unsafe { self . cast :: < u8 > ( ) . sub ( count) . cast :: < ( ) > ( ) } ;
@@ -1319,6 +1328,7 @@ impl<T: ?Sized> *mut T {
1319
1328
#[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
1320
1329
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1321
1330
#[ inline( always) ]
1331
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1322
1332
pub const unsafe fn copy_to ( self , dest : * mut T , count : usize )
1323
1333
where
1324
1334
T : Sized ,
@@ -1338,6 +1348,7 @@ impl<T: ?Sized> *mut T {
1338
1348
#[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
1339
1349
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1340
1350
#[ inline( always) ]
1351
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1341
1352
pub const unsafe fn copy_to_nonoverlapping ( self , dest : * mut T , count : usize )
1342
1353
where
1343
1354
T : Sized ,
@@ -1357,6 +1368,7 @@ impl<T: ?Sized> *mut T {
1357
1368
#[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
1358
1369
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1359
1370
#[ inline( always) ]
1371
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1360
1372
pub const unsafe fn copy_from ( self , src : * const T , count : usize )
1361
1373
where
1362
1374
T : Sized ,
@@ -1376,6 +1388,7 @@ impl<T: ?Sized> *mut T {
1376
1388
#[ rustc_const_stable( feature = "const_intrinsic_copy" , since = "1.63.0" ) ]
1377
1389
#[ stable( feature = "pointer_methods" , since = "1.26.0" ) ]
1378
1390
#[ inline( always) ]
1391
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1379
1392
pub const unsafe fn copy_from_nonoverlapping ( self , src : * const T , count : usize )
1380
1393
where
1381
1394
T : Sized ,
0 commit comments