Skip to content

Commit 96cfd8c

Browse files
committed
Add repr(transparent) to Reg struct
To guarantee that the register has the proper layout so that the cast of an integer to a *const RegisterBlock is sound.
1 parent 9718140 commit 96cfd8c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/generate/generic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub trait Resettable: RegisterSpec {
3434
}
3535

3636
/// This structure provides volatile access to registers.
37+
#[repr(transparent)]
3738
pub struct Reg<REG: RegisterSpec> {
3839
register: vcell::VolatileCell<REG::Ux>,
3940
_marker: marker::PhantomData<REG>,

0 commit comments

Comments
 (0)