@@ -1926,7 +1926,10 @@ safety_comment! {
19261926 /// TODO(#429), TODO(https://github.com/rust-lang/rust/pull/115333): Cite
19271927 /// the Stable docs once they're available.
19281928 #[ cfg( feature = "alloc" ) ]
1929- unsafe_impl!( T => FromZeroes for Option <Box <T >>) ;
1929+ unsafe_impl!(
1930+ #[ cfg_attr( doc_cfg, doc( cfg( feature = "alloc" ) ) ) ]
1931+ T => FromZeroes for Option <Box <T >>
1932+ ) ;
19301933 unsafe_impl!( T => FromZeroes for Option <& ' _ T >) ;
19311934 unsafe_impl!( T => FromZeroes for Option <& ' _ mut T >) ;
19321935 unsafe_impl!( T => FromZeroes for Option <NonNull <T >>) ;
@@ -2149,6 +2152,7 @@ safety_comment! {
21492152// [1] https://rust-lang.github.io/unsafe-code-guidelines/layout/packed-simd-vectors.html
21502153// [2] https://github.com/rust-lang/unsafe-code-guidelines/issues/38
21512154#[ cfg( feature = "simd" ) ]
2155+ #[ cfg_attr( doc_cfg, doc( cfg( feature = "simd" ) ) ) ]
21522156mod simd {
21532157 /// Defines a module which implements `FromZeroes`, `FromBytes`, and
21542158 /// `AsBytes` for a set of types from a module in `core::arch`.
@@ -2160,7 +2164,9 @@ mod simd {
21602164 // target/feature combinations don't emit any impls
21612165 // and thus don't use this macro.
21622166 macro_rules! simd_arch_mod {
2163- ( $arch: ident, $mod: ident, $( $typ: ident) ,* ) => {
2167+ ( #[ cfg $cfg: tt] $arch: ident, $mod: ident, $( $typ: ident) ,* ) => {
2168+ #[ cfg $cfg]
2169+ #[ cfg_attr( doc_cfg, doc( cfg $cfg) ) ]
21642170 mod $mod {
21652171 use core:: arch:: $arch:: { $( $typ) ,* } ;
21662172
@@ -2175,48 +2181,51 @@ mod simd {
21752181 } ;
21762182 }
21772183
2178- #[ cfg( target_arch = "x86" ) ]
2179- simd_arch_mod ! ( x86, x86, __m128, __m128d, __m128i, __m256, __m256d, __m256i) ;
2180- #[ cfg( all( feature = "simd-nightly" , target_arch = "x86" ) ) ]
2181- simd_arch_mod ! ( x86, x86_nightly, __m512bh, __m512, __m512d, __m512i) ;
2182- #[ cfg( target_arch = "x86_64" ) ]
2183- simd_arch_mod ! ( x86_64, x86_64, __m128, __m128d, __m128i, __m256, __m256d, __m256i) ;
2184- #[ cfg( all( feature = "simd-nightly" , target_arch = "x86_64" ) ) ]
2185- simd_arch_mod ! ( x86_64, x86_64_nightly, __m512bh, __m512, __m512d, __m512i) ;
2186- #[ cfg( target_arch = "wasm32" ) ]
2187- simd_arch_mod ! ( wasm32, wasm32, v128) ;
2188- #[ cfg( all( feature = "simd-nightly" , target_arch = "powerpc" ) ) ]
2189- simd_arch_mod ! (
2190- powerpc,
2191- powerpc,
2192- vector_bool_long,
2193- vector_double,
2194- vector_signed_long,
2195- vector_unsigned_long
2196- ) ;
2197- #[ cfg( all( feature = "simd-nightly" , target_arch = "powerpc64" ) ) ]
2198- simd_arch_mod ! (
2199- powerpc64,
2200- powerpc64,
2201- vector_bool_long,
2202- vector_double,
2203- vector_signed_long,
2204- vector_unsigned_long
2205- ) ;
2206- #[ cfg( target_arch = "aarch64" ) ]
22072184 #[ rustfmt:: skip]
2208- simd_arch_mod ! (
2209- aarch64, aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
2210- int8x8x3_t, int8x8x4_t, int8x16_t, int8x16x2_t, int8x16x3_t, int8x16x4_t, int16x4_t,
2211- int16x8_t, int32x2_t, int32x4_t, int64x1_t, int64x2_t, poly8x8_t, poly8x8x2_t, poly8x8x3_t,
2212- poly8x8x4_t, poly8x16_t, poly8x16x2_t, poly8x16x3_t, poly8x16x4_t, poly16x4_t, poly16x8_t,
2213- poly64x1_t, poly64x2_t, uint8x8_t, uint8x8x2_t, uint8x8x3_t, uint8x8x4_t, uint8x16_t,
2214- uint8x16x2_t, uint8x16x3_t, uint8x16x4_t, uint16x4_t, uint16x8_t, uint32x2_t, uint32x4_t,
2215- uint64x1_t, uint64x2_t
2216- ) ;
2217- #[ cfg( all( feature = "simd-nightly" , target_arch = "arm" ) ) ]
2218- #[ rustfmt:: skip]
2219- simd_arch_mod ! ( arm, arm, int8x4_t, uint8x4_t) ;
2185+ const _: ( ) = {
2186+ simd_arch_mod ! (
2187+ #[ cfg( target_arch = "x86" ) ]
2188+ x86, x86, __m128, __m128d, __m128i, __m256, __m256d, __m256i
2189+ ) ;
2190+ simd_arch_mod ! (
2191+ #[ cfg( all( feature = "simd-nightly" , target_arch = "x86" ) ) ]
2192+ x86, x86_nightly, __m512bh, __m512, __m512d, __m512i
2193+ ) ;
2194+ simd_arch_mod ! (
2195+ #[ cfg( target_arch = "x86_64" ) ]
2196+ x86_64, x86_64, __m128, __m128d, __m128i, __m256, __m256d, __m256i
2197+ ) ;
2198+ simd_arch_mod ! (
2199+ #[ cfg( all( feature = "simd-nightly" , target_arch = "x86_64" ) ) ]
2200+ x86_64, x86_64_nightly, __m512bh, __m512, __m512d, __m512i
2201+ ) ;
2202+ simd_arch_mod ! (
2203+ #[ cfg( target_arch = "wasm32" ) ]
2204+ wasm32, wasm32, v128
2205+ ) ;
2206+ simd_arch_mod ! (
2207+ #[ cfg( all( feature = "simd-nightly" , target_arch = "powerpc" ) ) ]
2208+ powerpc, powerpc, vector_bool_long, vector_double, vector_signed_long, vector_unsigned_long
2209+ ) ;
2210+ simd_arch_mod ! (
2211+ #[ cfg( all( feature = "simd-nightly" , target_arch = "powerpc64" ) ) ]
2212+ powerpc64, powerpc64, vector_bool_long, vector_double, vector_signed_long, vector_unsigned_long
2213+ ) ;
2214+ simd_arch_mod ! (
2215+ #[ cfg( target_arch = "aarch64" ) ]
2216+ aarch64, aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
2217+ int8x8x3_t, int8x8x4_t, int8x16_t, int8x16x2_t, int8x16x3_t, int8x16x4_t, int16x4_t,
2218+ int16x8_t, int32x2_t, int32x4_t, int64x1_t, int64x2_t, poly8x8_t, poly8x8x2_t, poly8x8x3_t,
2219+ poly8x8x4_t, poly8x16_t, poly8x16x2_t, poly8x16x3_t, poly8x16x4_t, poly16x4_t, poly16x8_t,
2220+ poly64x1_t, poly64x2_t, uint8x8_t, uint8x8x2_t, uint8x8x3_t, uint8x8x4_t, uint8x16_t,
2221+ uint8x16x2_t, uint8x16x3_t, uint8x16x4_t, uint16x4_t, uint16x8_t, uint32x2_t, uint32x4_t,
2222+ uint64x1_t, uint64x2_t
2223+ ) ;
2224+ simd_arch_mod ! (
2225+ #[ cfg( all( feature = "simd-nightly" , target_arch = "arm" ) ) ]
2226+ arm, arm, int8x4_t, uint8x4_t
2227+ ) ;
2228+ } ;
22202229}
22212230
22222231/// Safely transmutes a value of one type to a value of another type of the same
@@ -3658,6 +3667,7 @@ unsafe impl<'a> ByteSliceMut for &'a mut [u8] {}
36583667unsafe impl < ' a > ByteSliceMut for RefMut < ' a , [ u8 ] > { }
36593668
36603669#[ cfg( feature = "alloc" ) ]
3670+ #[ cfg_attr( doc_cfg, doc( cfg( feature = "alloc" ) ) ) ]
36613671mod alloc_support {
36623672 use alloc:: vec:: Vec ;
36633673
@@ -3875,7 +3885,6 @@ mod alloc_support {
38753885}
38763886
38773887#[ cfg( feature = "alloc" ) ]
3878- #[ cfg_attr( doc_cfg, doc( cfg( feature = "alloc" ) ) ) ]
38793888#[ doc( inline) ]
38803889pub use alloc_support:: * ;
38813890
0 commit comments