volatile-register
volatile-register copied to clipboard
#[repr(C)] and UnsafeCell
In the WO struct you use an UnsafeCell to hold the value, but UnsafeCell isn't repr(C) compatible. This causes rust to throw a warning that some struct element isn't repr(C) and should be.
I'm unsure whether or not this breaks things in practice, so what's the fix here, if any? My fork just made it work like RW structs, but would require a minor change to svd2rust (all write functions use mutable borrows).
This causes rust to throw a warning that some struct element isn't repr(C) and should be.
In what cases does it throw a warning? FFI boundary?
I'm unsure whether or not this breaks things in practice
Now that we don't have "drop flags", it doesn't.
what's the fix here, if any?
We could mark UnsafeCell, itself, as repr(C).
My fork just made it work like RW structs,
For now, I'd rather not change the API of only WO. I want to review the whole API in the (near?) future.