Skip to content

Commit 3f2d622

Browse files
authored
zeroizing: add repr(transparent) to Zeroizing (#1253)
This commit adds a repr(transparent) annotation to zeroize::Zeroizing, allowing it to be used safely for FFI in more contexts. See #1249 for more details.
1 parent e38a015 commit 3f2d622

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

zeroize/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,11 @@ impl Zeroize for CString {
619619

620620
/// `Zeroizing` is a wrapper for any `Z: Zeroize` type which implements a
621621
/// `Drop` handler which zeroizes dropped values.
622+
///
623+
/// Zeroizing<T> is defined with `repr(transparent)`, which means it is
624+
/// guaranteed to have the same physical representation as the underlying type.
622625
#[derive(Debug, Default, Eq, PartialEq)]
626+
#[repr(transparent)]
623627
pub struct Zeroizing<Z: Zeroize>(Z);
624628

625629
impl<Z> Zeroizing<Z>

0 commit comments

Comments
 (0)