about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-13 14:10:14 -0700
committerGitHub <noreply@github.com>2022-08-13 14:10:14 -0700
commitf8bdd9c680a5c6d39bdde8f73626de2cc0aa3d51 (patch)
tree835f198d2e6559cfa51f183bc0e48cbb1e9d2b45
parentaafaec38bbbab2395e057cee4e188c6b9a68373a (diff)
parent2dc9bf0fa01e156476017f94b713749bc8653e62 (diff)
downloadrust-f8bdd9c680a5c6d39bdde8f73626de2cc0aa3d51.tar.gz
rust-f8bdd9c680a5c6d39bdde8f73626de2cc0aa3d51.zip
Rollup merge of #100501 - RalfJung:miri-from-exposed-addr, r=Mark-Simulacrum
nicer Miri backtraces for from_exposed_addr

Miri by default warns about using from_exposed_addr; this makes the span for that a bit nicer.
-rw-r--r--library/core/src/ptr/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs
index 57adcd6bb34..203531f66aa 100644
--- a/library/core/src/ptr/mod.rs
+++ b/library/core/src/ptr/mod.rs
@@ -603,6 +603,7 @@ pub const fn invalid_mut<T>(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<T>(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<T>(addr: usize) -> *mut T
 where
     T: Sized,