@@ -1138,7 +1138,6 @@ pub const unsafe fn swap<T>(x: *mut T, y: *mut T) {
1138
1138
#[ stable( feature = "swap_nonoverlapping" , since = "1.27.0" ) ]
1139
1139
#[ rustc_const_unstable( feature = "const_swap" , issue = "83163" ) ]
1140
1140
#[ rustc_diagnostic_item = "ptr_swap_nonoverlapping" ]
1141
- #[ track_caller]
1142
1141
pub const unsafe fn swap_nonoverlapping < T > ( x : * mut T , y : * mut T , count : usize ) {
1143
1142
#[ allow( unused) ]
1144
1143
macro_rules! attempt_swap_as_chunks {
@@ -1269,7 +1268,6 @@ const unsafe fn swap_nonoverlapping_simple_untyped<T>(x: *mut T, y: *mut T, coun
1269
1268
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1270
1269
#[ rustc_const_unstable( feature = "const_replace" , issue = "83164" ) ]
1271
1270
#[ rustc_diagnostic_item = "ptr_replace" ]
1272
- #[ track_caller]
1273
1271
pub const unsafe fn replace < T > ( dst : * mut T , src : T ) -> T {
1274
1272
// SAFETY: the caller must guarantee that `dst` is valid to be
1275
1273
// cast to a mutable reference (valid for writes, aligned, initialized),
@@ -1396,7 +1394,7 @@ pub const unsafe fn replace<T>(dst: *mut T, src: T) -> T {
1396
1394
#[ inline]
1397
1395
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1398
1396
#[ rustc_const_stable( feature = "const_ptr_read" , since = "1.71.0" ) ]
1399
- #[ track_caller]
1397
+ #[ cfg_attr ( miri , track_caller) ] // even without panics, this helps for Miri backtraces
1400
1398
#[ rustc_diagnostic_item = "ptr_read" ]
1401
1399
pub const unsafe fn read < T > ( src : * const T ) -> T {
1402
1400
// It would be semantically correct to implement this via `copy_nonoverlapping`
@@ -1622,7 +1620,7 @@ pub const unsafe fn read_unaligned<T>(src: *const T) -> T {
1622
1620
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1623
1621
#[ rustc_const_unstable( feature = "const_ptr_write" , issue = "86302" ) ]
1624
1622
#[ rustc_diagnostic_item = "ptr_write" ]
1625
- #[ track_caller]
1623
+ #[ cfg_attr ( miri , track_caller) ] // even without panics, this helps for Miri backtraces
1626
1624
pub const unsafe fn write < T > ( dst : * mut T , src : T ) {
1627
1625
// Semantically, it would be fine for this to be implemented as a
1628
1626
// `copy_nonoverlapping` and appropriate drop suppression of `src`.
@@ -1804,7 +1802,7 @@ pub const unsafe fn write_unaligned<T>(dst: *mut T, src: T) {
1804
1802
/// ```
1805
1803
#[ inline]
1806
1804
#[ stable( feature = "volatile" , since = "1.9.0" ) ]
1807
- #[ track_caller]
1805
+ #[ cfg_attr ( miri , track_caller) ] // even without panics, this helps for Miri backtraces
1808
1806
#[ rustc_diagnostic_item = "ptr_read_volatile" ]
1809
1807
pub unsafe fn read_volatile < T > ( src : * const T ) -> T {
1810
1808
// SAFETY: the caller must uphold the safety contract for `volatile_load`.
@@ -1884,7 +1882,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
1884
1882
#[ inline]
1885
1883
#[ stable( feature = "volatile" , since = "1.9.0" ) ]
1886
1884
#[ rustc_diagnostic_item = "ptr_write_volatile" ]
1887
- #[ track_caller]
1885
+ #[ cfg_attr ( miri , track_caller) ] // even without panics, this helps for Miri backtraces
1888
1886
pub unsafe fn write_volatile < T > ( dst : * mut T , src : T ) {
1889
1887
// SAFETY: the caller must uphold the safety contract for `volatile_store`.
1890
1888
unsafe {
0 commit comments