The safety documentation on AnyBitPattern mentions validity, but not safety.
From what I can tell an inhabited ZST with a trivially false safety invariant satisfies all the conditions listed (except the last, I guess).
mod foo {
/// # SAFETY
///
/// Sound APIs can assume that they will never observe values of this type
pub struct UnsafelyInhabited{
_priv: PhantomData<()>
}
pub fn explode(_ui: UnsafelyInhabited) {
unsafe {unreachable_unchecked()}
}
}
The safety documentation on
AnyBitPattern
mentions validity, but not safety.From what I can tell an inhabited ZST with a trivially false safety invariant satisfies all the conditions listed (except the last, I guess).