@@ -187,19 +187,24 @@ unsafe impl thin::SizeOfDebug for Malloc {
187187
188188
189189
190+ #[ cfg( test) ] const MALLOC_ZERO_INITS : bool = cfg ! ( any(
191+ target_os = "linux" , // from the start of `ialloc` on CI and WSL
192+ target_os = "macos" , // github's `macos-11` runners didn't zero init, but `macos-14`(? via `macos-latest`) does.
193+ ) ) ;
194+
190195#[ test] fn thin_alignment ( ) { thin:: test:: alignment ( Malloc ) }
191196#[ test] fn thin_edge_case_sizes ( ) { thin:: test:: edge_case_sizes ( Malloc ) }
192197#[ test] fn thin_nullable ( ) { thin:: test:: nullable ( Malloc ) }
193198#[ test] fn thin_size ( ) { thin:: test:: size_over_alloc ( Malloc ) }
194- #[ test] fn thin_uninit ( ) { if !cfg ! ( target_os = "linux" ) { unsafe { thin:: test:: uninit_alloc_unsound ( Malloc ) } } } // malloc returns zeroed memory on some platforms
199+ #[ test] fn thin_uninit ( ) { if !MALLOC_ZERO_INITS { unsafe { thin:: test:: uninit_alloc_unsound ( Malloc ) } } }
195200#[ test] fn thin_zeroed ( ) { thin:: test:: zeroed_alloc ( Malloc ) }
196201#[ test] fn thin_zst_support ( ) { thin:: test:: zst_supported_conservative ( Malloc ) }
197202#[ test] fn thin_zst_support_dangle ( ) { thin:: test:: zst_supported_conservative ( crate :: allocator:: adapt:: DangleZst ( Malloc ) ) }
198203#[ test] fn thin_zst_support_alloc ( ) { thin:: test:: zst_supported_conservative ( crate :: allocator:: adapt:: AllocZst ( Malloc ) ) }
199204
200205#[ test] fn fat_alignment ( ) { fat:: test:: alignment ( Malloc ) }
201206#[ test] fn fat_edge_case_sizes ( ) { fat:: test:: edge_case_sizes ( Malloc ) }
202- #[ test] fn fat_uninit ( ) { if !cfg ! ( target_os = "linux" ) { unsafe { fat:: test:: uninit_alloc_unsound ( Malloc ) } } } // malloc returns zeroed memory on some platforms
207+ #[ test] fn fat_uninit ( ) { if !MALLOC_ZERO_INITS { unsafe { fat:: test:: uninit_alloc_unsound ( Malloc ) } } }
203208#[ test] fn fat_zeroed ( ) { fat:: test:: zeroed_alloc ( Malloc ) }
204209#[ test] fn fat_zst_support ( ) { fat:: test:: zst_supported_conservative ( Malloc ) }
205210#[ test] fn fat_zst_support_dangle ( ) { fat:: test:: zst_supported_conservative ( crate :: allocator:: adapt:: DangleZst ( Malloc ) ) }
0 commit comments