about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohannes Hostert <jhostert@ethz.ch>2024-07-04 12:01:49 +0200
committerJohannes Hostert <jhostert@ethz.ch>2024-07-04 12:20:14 +0200
commit02bec40930d7256d290c6a61b60df8284e460dda (patch)
tree77e46662cf15d3f69ef5a7abe014414798d5bd58
parent0a86e7966442e12fa2080727d08047fdd2d3e619 (diff)
downloadrust-02bec40930d7256d290c6a61b60df8284e460dda.tar.gz
rust-02bec40930d7256d290c6a61b60df8284e460dda.zip
TB: protector end semantics never causes immediate UB
-rw-r--r--src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs
index 498b7dc3e42..a753de28a04 100644
--- a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs
+++ b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs
@@ -28,8 +28,11 @@ impl fmt::Display for AccessCause {
             Self::Explicit(kind) => write!(f, "{kind}"),
             Self::Reborrow => write!(f, "reborrow"),
             Self::Dealloc => write!(f, "deallocation"),
-            Self::FnExit(AccessKind::Read) => write!(f, "protector release read"),
-            Self::FnExit(AccessKind::Write) => write!(f, "protector release write"),
+            // This is dead code, since the protector release access itself can never
+            // cause UB (while the protector is active, if some other access invalidates
+            // further use of the protected tag, that is immediate UB).
+            // Describing the cause of UB is the only time this function is called.
+            Self::FnExit(_) => unreachable!("protector accesses can never be the source of UB"),
         }
     }
 }