@@ -298,7 +298,7 @@ where
298298 Z : DefaultIsZeroes ,
299299{
300300 fn zeroize ( & mut self ) {
301- * self = Z :: default ( ) ;
301+ unsafe { ptr :: write_volatile ( self , Z :: default ( ) ) } ;
302302 optimization_barrier ( self ) ;
303303 }
304304}
@@ -866,38 +866,6 @@ unsafe fn write_zeros<T>(dst: *mut T) {
866866
867867/// Write `len * size_of::<T>()` zero bytes to the memory pointed by `dst`.
868868unsafe fn write_zeros_multi < T > ( dst : * mut T , len : usize ) {
869- #[ cfg( all(
870- not( miri) ,
871- any(
872- target_arch = "aarch64" ,
873- target_arch = "arm" ,
874- target_arch = "arm64ec" ,
875- target_arch = "loongarch64" ,
876- target_arch = "riscv32" ,
877- target_arch = "riscv64" ,
878- target_arch = "s390x" ,
879- target_arch = "x86" ,
880- target_arch = "x86_64" ,
881- )
882- ) ) ]
883- unsafe {
884- ptr:: write_bytes ( dst, 0 , len) ;
885- }
886-
887- #[ cfg( not( all(
888- not( miri) ,
889- any(
890- target_arch = "aarch64" ,
891- target_arch = "arm" ,
892- target_arch = "arm64ec" ,
893- target_arch = "loongarch64" ,
894- target_arch = "riscv32" ,
895- target_arch = "riscv64" ,
896- target_arch = "s390x" ,
897- target_arch = "x86" ,
898- target_arch = "x86_64" ,
899- )
900- ) ) ) ]
901869 for i in 0 ..len {
902870 // Safety:
903871 //
0 commit comments