From 2dc9bf0fa01e156476017f94b713749bc8653e62 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 13 Aug 2022 12:55:43 -0400 Subject: [PATCH] nicer Miri backtraces for from_exposed_addr --- library/core/src/ptr/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 57adcd6bb3405..203531f66aa36 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -603,6 +603,7 @@ pub const fn invalid_mut(addr: usize) -> *mut T { #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] +#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn from_exposed_addr(addr: usize) -> *const T where T: Sized, @@ -639,6 +640,7 @@ where #[must_use] #[inline] #[unstable(feature = "strict_provenance", issue = "95228")] +#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub fn from_exposed_addr_mut(addr: usize) -> *mut T where T: Sized,