The clear_on_drop crate is no longer maintained and uses fragile techniques. We expected it to break as linker optimizations work their way into rustc, etc. You should expose zeroing with the zeroize and if your dependencies do not yet support zeroing then you can implement the Zeroize trait using a function like
#[inline(always)]
fn zeroize_hack<Z: Default>(z: &mut Z) {
use core::{ptr, sync::atomic};
unsafe { ptr::write_volatile(z, Z::default()); }
atomic::compiler_fence(atomic::Ordering::SeqCst);
}
The clear_on_drop crate is no longer maintained and uses fragile techniques. We expected it to break as linker optimizations work their way into rustc, etc. You should expose zeroing with the zeroize and if your dependencies do not yet support zeroing then you can implement the
Zeroizetrait using a function like