Documentation for variadics (#15387)

# Objective

Relevant: #15208

## Solution

I went ahead and added the variadics documentation in all applicable
locations.

## Testing

- I built the documentation and inspected it to see whether the feature
is there.
This commit is contained in:
Benjamin Brienen 2024-10-02 14:48:36 +02:00 committed by GitHub
parent 461305b3d7
commit c841dd92a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 44 additions and 11 deletions

View File

@ -1,4 +1,6 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// `rustdoc_internals` is needed for `#[doc(fake_variadics)]`
#![allow(internal_features)]
#![cfg_attr(any(docsrs, docsrs_dep), feature(doc_auto_cfg, rustdoc_internals))]
#![forbid(unsafe_code)]
#![doc(
html_logo_url = "https://bevyengine.org/assets/icon.png",

View File

@ -162,7 +162,8 @@ mod sealed {
}
macro_rules! impl_plugins_tuples {
($(($param: ident, $plugins: ident)),*) => {
($(#[$meta:meta])* $(($param: ident, $plugins: ident)),*) => {
$(#[$meta])*
impl<$($param, $plugins),*> Plugins<(PluginsTupleMarker, $($param,)*)> for ($($plugins,)*)
where
$($plugins: Plugins<$param>),*
@ -179,5 +180,12 @@ mod sealed {
}
}
all_tuples!(impl_plugins_tuples, 0, 15, P, S);
all_tuples!(
#[doc(fake_variadic)]
impl_plugins_tuples,
0,
15,
P,
S
);
}

View File

@ -287,6 +287,7 @@ macro_rules! tuple_impl {
}
}
$(#[$meta])*
impl<$($name: Bundle),*> DynamicBundle for ($($name,)*) {
#[allow(unused_variables, unused_mut)]
#[inline(always)]

View File

@ -2014,7 +2014,6 @@ pub struct AnyOf<T>(PhantomData<T>);
macro_rules! impl_tuple_query_data {
($(#[$meta:meta])* $(($name: ident, $state: ident)),*) => {
#[allow(non_snake_case)]
#[allow(clippy::unused_unit)]
$(#[$meta])*
@ -2023,6 +2022,7 @@ macro_rules! impl_tuple_query_data {
type ReadOnly = ($($name::ReadOnly,)*);
}
$(#[$meta])*
/// SAFETY: each item in the tuple is read only
unsafe impl<$($name: ReadOnlyQueryData),*> ReadOnlyQueryData for ($($name,)*) {}

View File

@ -520,7 +520,7 @@
//! [the language feature for dyn upcasting coercion]: https://github.com/rust-lang/rust/issues/65991
//! [derive macro]: derive@crate::Reflect
//! [`'static` lifetime]: https://doc.rust-lang.org/rust-by-example/scope/lifetime/static_lifetime.html#trait-bound
//! [`Function`]: func::Function
//! [`Function`]: crate::func::Function
//! [derive macro documentation]: derive@crate::Reflect
//! [deriving `Reflect`]: derive@crate::Reflect
//! [type data]: TypeData

View File

@ -676,6 +676,7 @@ impl_reflect_tuple! {0: A, 1: B, 2: C, 3: D, 4: E, 5: F, 6: G, 7: H, 8: I, 9: J,
macro_rules! impl_type_path_tuple {
($(#[$meta:meta])*) => {
$(#[$meta])*
impl TypePath for () {
fn type_path() -> &'static str {
"()"
@ -737,29 +738,50 @@ all_tuples!(
#[cfg(feature = "functions")]
const _: () = {
macro_rules! impl_get_ownership_tuple {
($($name: ident),*) => {
($(#[$meta:meta])* $($name: ident),*) => {
$(#[$meta])*
$crate::func::args::impl_get_ownership!(($($name,)*); <$($name),*>);
};
}
all_tuples!(impl_get_ownership_tuple, 0, 12, P);
all_tuples!(
#[doc(fake_variadic)]
impl_get_ownership_tuple,
0,
12,
P
);
macro_rules! impl_from_arg_tuple {
($($name: ident),*) => {
($(#[$meta:meta])* $($name: ident),*) => {
$(#[$meta])*
$crate::func::args::impl_from_arg!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
};
}
all_tuples!(impl_from_arg_tuple, 0, 12, P);
all_tuples!(
#[doc(fake_variadic)]
impl_from_arg_tuple,
0,
12,
P
);
macro_rules! impl_into_return_tuple {
($($name: ident),+) => {
($(#[$meta:meta])* $($name: ident),+) => {
$(#[$meta])*
$crate::func::impl_into_return!(($($name,)*); <$($name: FromReflect + MaybeTyped + TypePath + GetTypeRegistration),*>);
};
}
// The unit type (i.e. `()`) is special-cased, so we skip implementing it here.
all_tuples!(impl_into_return_tuple, 1, 12, P);
all_tuples!(
#[doc(fake_variadic)]
impl_into_return_tuple,
1,
12,
P
);
};
#[cfg(test)]