276276 all( feature = "unsafe-pinned" , CONFIG_RUSTC_HAS_UNSAFE_PINNED ) ,
277277 feature( unsafe_pinned)
278278) ]
279+ #![ cfg_attr( all( USE_RUSTC_FEATURES , doc) , allow( internal_features) ) ]
280+ #![ cfg_attr( all( USE_RUSTC_FEATURES , doc) , feature( rustdoc_internals) ) ]
279281
280282use core:: {
281283 cell:: UnsafeCell ,
@@ -1638,9 +1640,15 @@ impl_zeroable! {
16381640}
16391641
16401642macro_rules! impl_tuple_zeroable {
1641- ( $( , ) ?) => { } ;
1643+ ( $first: ident, $( , ) ?) => {
1644+ #[ cfg_attr( all( USE_RUSTC_FEATURES , doc) , doc( fake_variadic) ) ]
1645+ /// Implemented for tuples up to 10 items long.
1646+ // SAFETY: All elements are zeroable and padding can be zero.
1647+ unsafe impl <$first: Zeroable > Zeroable for ( $first, ) { }
1648+ } ;
16421649 ( $first: ident, $( $t: ident) ,* $( , ) ?) => {
16431650 // SAFETY: All elements are zeroable and padding can be zero.
1651+ #[ cfg_attr( doc, doc( hidden) ) ]
16441652 unsafe impl <$first: Zeroable , $( $t: Zeroable ) ,* > Zeroable for ( $first, $( $t) ,* ) { }
16451653 impl_tuple_zeroable!( $( $t) ,* , ) ;
16461654 }
@@ -1654,9 +1662,18 @@ macro_rules! impl_fn_zeroable_option {
16541662 $( impl_fn_zeroable_option!( { unsafe extern $abi} $args) ; ) *
16551663 } ;
16561664 ( { $( $prefix: tt) * } { $( , ) ?} ) => { } ;
1665+ ( { $( $prefix: tt) * } { $ret: ident, $arg: ident $( , ) ?} ) => {
1666+ #[ cfg_attr( all( USE_RUSTC_FEATURES , doc) , doc( fake_variadic) ) ]
1667+ /// Implemented for function pointers with up to 20 arity.
1668+ // SAFETY: function pointers are part of the option layout optimization:
1669+ // <https://doc.rust-lang.org/stable/std/option/index.html#representation>.
1670+ unsafe impl <$ret, $arg> ZeroableOption for $( $prefix) * fn ( $arg) -> $ret { }
1671+ impl_fn_zeroable_option!( { $( $prefix) * } { $arg, } ) ;
1672+ } ;
16571673 ( { $( $prefix: tt) * } { $ret: ident, $( $rest: ident) ,* $( , ) ?} ) => {
16581674 // SAFETY: function pointers are part of the option layout optimization:
16591675 // <https://doc.rust-lang.org/stable/std/option/index.html#representation>.
1676+ #[ cfg_attr( doc, doc( hidden) ) ]
16601677 unsafe impl <$ret, $( $rest) ,* > ZeroableOption for $( $prefix) * fn ( $( $rest) ,* ) -> $ret { }
16611678 impl_fn_zeroable_option!( { $( $prefix) * } { $( $rest) ,* , } ) ;
16621679 } ;
0 commit comments