TB: protector end semantics never causes immediate UB

This commit is contained in:
Johannes Hostert 2024-07-04 12:01:49 +02:00
parent 0a86e79664
commit 02bec40930
No known key found for this signature in database
GPG Key ID: 0BA6032B5A38D049

View File

@ -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"),
}
}
}