In C, fields can be defined as volatile whereas for Rust it is the accesses. I'm wondering if we should consider wrapping any volatile members in some UnsafeCell-based wrapper to ensure they aren't read by accident.
Unfortunately this is a bit tricky since we can't allow it to be moved by the compiler.
I'm thinking maybe we should provide a struct Volatile<T>(UnsafeCell<T>); wrapper type that at least makes it clear what these fields are, even if we can't actually enforce volatility.
In C, fields can be defined as volatile whereas for Rust it is the accesses. I'm wondering if we should consider wrapping any volatile members in some
UnsafeCell
-based wrapper to ensure they aren't read by accident.Unfortunately this is a bit tricky since we can't allow it to be moved by the compiler.