@@ -1095,6 +1095,7 @@ pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
1095
1095
#[ inline]
1096
1096
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1097
1097
#[ rustc_const_unstable( feature = "const_ptr_read" , issue = "80377" ) ]
1098
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1098
1099
pub const unsafe fn read < T > ( src : * const T ) -> T {
1099
1100
// We are calling the intrinsics directly to avoid function calls in the generated code
1100
1101
// as `intrinsics::copy_nonoverlapping` is a wrapper function.
@@ -1194,6 +1195,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
1194
1195
#[ inline]
1195
1196
#[ stable( feature = "ptr_unaligned" , since = "1.17.0" ) ]
1196
1197
#[ rustc_const_unstable( feature = "const_ptr_read" , issue = "80377" ) ]
1198
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1197
1199
pub const unsafe fn read_unaligned < T > ( src : * const T ) -> T {
1198
1200
let mut tmp = MaybeUninit :: < T > :: uninit ( ) ;
1199
1201
// SAFETY: the caller must guarantee that `src` is valid for reads.
@@ -1290,6 +1292,7 @@ pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
1290
1292
#[ inline]
1291
1293
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1292
1294
#[ rustc_const_unstable( feature = "const_ptr_write" , issue = "86302" ) ]
1295
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1293
1296
pub const unsafe fn write < T > ( dst : * mut T , src : T ) {
1294
1297
// We are calling the intrinsics directly to avoid function calls in the generated code
1295
1298
// as `intrinsics::copy_nonoverlapping` is a wrapper function.
@@ -1387,6 +1390,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
1387
1390
#[ inline]
1388
1391
#[ stable( feature = "ptr_unaligned" , since = "1.17.0" ) ]
1389
1392
#[ rustc_const_unstable( feature = "const_ptr_write" , issue = "86302" ) ]
1393
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1390
1394
pub const unsafe fn write_unaligned < T > ( dst : * mut T , src : T ) {
1391
1395
// SAFETY: the caller must guarantee that `dst` is valid for writes.
1392
1396
// `dst` cannot overlap `src` because the caller has mutable access
@@ -1460,6 +1464,7 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
1460
1464
/// ```
1461
1465
#[ inline]
1462
1466
#[ stable( feature = "volatile" , since = "1.9.0" ) ]
1467
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1463
1468
pub unsafe fn read_volatile < T > ( src : * const T ) -> T {
1464
1469
// SAFETY: the caller must uphold the safety contract for `volatile_load`.
1465
1470
unsafe {
@@ -1530,6 +1535,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
1530
1535
/// ```
1531
1536
#[ inline]
1532
1537
#[ stable( feature = "volatile" , since = "1.9.0" ) ]
1538
+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
1533
1539
pub unsafe fn write_volatile < T > ( dst : * mut T , src : T ) {
1534
1540
// SAFETY: the caller must uphold the safety contract for `volatile_store`.
1535
1541
unsafe {
0 commit comments