Include racy reads in Rust memory model with `MaybeInvalid<T>`
By "cannot return torn values" you mean that the cases where values would be torn, it'll just be UB instead, right?
Exactly. Writes are still done through UnsafeCell, so they must be serialized. A valid read, i.e. not racing with writes, means a torn value cannot be observed.
Though I'm not sure exactly on your subsequent point: what is "the
Dropissue of RFC 3301" that you're avoiding? (That's a long RFC and even longer discussion, so I have no idea what exactly you're referring to.)
RFC 3301 AtomicPerByte contains a MaybeUninit, so it cannot drop its content. So, even if you use it with a content which is always defined, for example in a SeqLock, you sill have to drop its content manually. This is mentioned as error-prone in the RFC drawbacks, and the RFC even mention to limit the content of AtomicPerByte to be Copy.
Discussion in the ATmosphere