diff --git a/interface/src/state/account.rs b/interface/src/state/account.rs index a734cb1d..aa6ba84d 100644 --- a/interface/src/state/account.rs +++ b/interface/src/state/account.rs @@ -151,7 +151,7 @@ impl Account { } } -impl Transmutable for Account { +unsafe impl Transmutable for Account { const LEN: usize = core::mem::size_of::(); } diff --git a/interface/src/state/mint.rs b/interface/src/state/mint.rs index 489c9ef0..655173e6 100644 --- a/interface/src/state/mint.rs +++ b/interface/src/state/mint.rs @@ -84,7 +84,7 @@ impl Mint { } } -impl Transmutable for Mint { +unsafe impl Transmutable for Mint { /// The length of the `Mint` account data. const LEN: usize = core::mem::size_of::(); } diff --git a/interface/src/state/mod.rs b/interface/src/state/mod.rs index 67de793b..79505eed 100644 --- a/interface/src/state/mod.rs +++ b/interface/src/state/mod.rs @@ -10,10 +10,12 @@ pub type COption = ([u8; 4], T); /// Marker trait for types that can be cast from a raw pointer. /// +/// # Safety +/// /// It is up to the type implementing this trait to guarantee that the cast is /// safe, i.e., the fields of the type are well aligned and there are no padding /// bytes. -pub trait Transmutable { +pub unsafe trait Transmutable { /// The length of the type. /// /// This must be equal to the size of each individual field in the type. diff --git a/interface/src/state/multisig.rs b/interface/src/state/multisig.rs index b579c3d1..7e453fd2 100644 --- a/interface/src/state/multisig.rs +++ b/interface/src/state/multisig.rs @@ -38,7 +38,7 @@ impl Multisig { } } -impl Transmutable for Multisig { +unsafe impl Transmutable for Multisig { /// The length of the `Multisig` account data. const LEN: usize = core::mem::size_of::(); }