diff options
| author | Ben Kimock <kimockb@gmail.com> | 2022-09-22 10:44:03 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2022-09-22 10:44:03 -0400 |
| commit | 5f498cab13800da77be7f6450a8d5264d31b0d1f (patch) | |
| tree | 995cf5d126acfaccdeecff61c405aff179f4d2bb /src/tools | |
| parent | 45d7121e9edb15873dce8868fe09c666aa451ecc (diff) | |
| download | rust-5f498cab13800da77be7f6450a8d5264d31b0d1f.tar.gz rust-5f498cab13800da77be7f6450a8d5264d31b0d1f.zip | |
Only add 'inside this call' for Invalidation diagnostics
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/miri/src/stacked_borrows/diagnostics.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/tools/miri/src/stacked_borrows/diagnostics.rs b/src/tools/miri/src/stacked_borrows/diagnostics.rs index 8deb8cda2e1..2cc7a88704e 100644 --- a/src/tools/miri/src/stacked_borrows/diagnostics.rs +++ b/src/tools/miri/src/stacked_borrows/diagnostics.rs @@ -66,13 +66,20 @@ enum InvalidationCause { impl Invalidation { fn generate_diagnostic(&self) -> (String, SpanData) { - ( + let message = if let InvalidationCause::Retag(_, RetagCause::FnEntry) = self.cause { + // For a FnEntry retag, our Span points at the caller. + // See `DiagnosticCx::log_invalidation`. + format!( + "{:?} was later invalidated at offsets {:?} by a {} inside this call", + self.tag, self.range, self.cause + ) + } else { format!( "{:?} was later invalidated at offsets {:?} by a {}", self.tag, self.range, self.cause - ), - self.span.data(), - ) + ) + }; + (message, self.span.data()) } } @@ -82,7 +89,7 @@ impl fmt::Display for InvalidationCause { InvalidationCause::Access(kind) => write!(f, "{}", kind), InvalidationCause::Retag(perm, kind) => if *kind == RetagCause::FnEntry { - write!(f, "{:?} FnEntry retag inside this call", perm) + write!(f, "{:?} FnEntry retag", perm) } else { write!(f, "{:?} retag", perm) }, |
