@@ -1095,6 +1095,7 @@ pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T {
10951095#[ inline]
10961096#[ stable( feature = "rust1" , since = "1.0.0" ) ]
10971097#[ rustc_const_unstable( feature = "const_ptr_read" , issue = "80377" ) ]
1098+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
10981099pub const unsafe fn read < T > ( src : * const T ) -> T {
10991100 // We are calling the intrinsics directly to avoid function calls in the generated code
11001101 // as `intrinsics::copy_nonoverlapping` is a wrapper function.
@@ -1194,6 +1195,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
11941195#[ inline]
11951196#[ stable( feature = "ptr_unaligned" , since = "1.17.0" ) ]
11961197#[ rustc_const_unstable( feature = "const_ptr_read" , issue = "80377" ) ]
1198+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
11971199pub const unsafe fn read_unaligned < T > ( src : * const T ) -> T {
11981200 let mut tmp = MaybeUninit :: < T > :: uninit ( ) ;
11991201 // 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 {
12901292#[ inline]
12911293#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12921294#[ rustc_const_unstable( feature = "const_ptr_write" , issue = "86302" ) ]
1295+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
12931296pub const unsafe fn write < T > ( dst : * mut T , src : T ) {
12941297 // We are calling the intrinsics directly to avoid function calls in the generated code
12951298 // as `intrinsics::copy_nonoverlapping` is a wrapper function.
@@ -1387,6 +1390,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
13871390#[ inline]
13881391#[ stable( feature = "ptr_unaligned" , since = "1.17.0" ) ]
13891392#[ rustc_const_unstable( feature = "const_ptr_write" , issue = "86302" ) ]
1393+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
13901394pub const unsafe fn write_unaligned < T > ( dst : * mut T , src : T ) {
13911395 // SAFETY: the caller must guarantee that `dst` is valid for writes.
13921396 // `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) {
14601464/// ```
14611465#[ inline]
14621466#[ stable( feature = "volatile" , since = "1.9.0" ) ]
1467+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
14631468pub unsafe fn read_volatile < T > ( src : * const T ) -> T {
14641469 // SAFETY: the caller must uphold the safety contract for `volatile_load`.
14651470 unsafe {
@@ -1530,6 +1535,7 @@ pub unsafe fn read_volatile<T>(src: *const T) -> T {
15301535/// ```
15311536#[ inline]
15321537#[ stable( feature = "volatile" , since = "1.9.0" ) ]
1538+ #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
15331539pub unsafe fn write_volatile < T > ( dst : * mut T , src : T ) {
15341540 // SAFETY: the caller must uphold the safety contract for `volatile_store`.
15351541 unsafe {
0 commit comments