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