Skip to content

Commit ff769ee

Browse files
authored
Rollup merge of rust-lang#129525 - notriddle:notriddle/fake-variadic-tuple-array, r=GuillaumeGomez
rustdoc: clean up tuple <-> primitive conversion docs This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2 parents 8ea71ae + 49aa496 commit ff769ee

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

Diff for: core/src/tuple.rs

+21-15
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,29 @@ macro_rules! tuple_impls {
122122
}
123123
}
124124

125-
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
126-
impl<T> From<[T; ${count($T)}]> for ($(${ignore($T)} T,)+) {
127-
#[inline]
128-
#[allow(non_snake_case)]
129-
fn from(array: [T; ${count($T)}]) -> Self {
130-
let [$($T,)+] = array;
131-
($($T,)+)
125+
maybe_tuple_doc! {
126+
$($T)+ @
127+
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
128+
impl<T> From<[T; ${count($T)}]> for ($(${ignore($T)} T,)+) {
129+
#[inline]
130+
#[allow(non_snake_case)]
131+
fn from(array: [T; ${count($T)}]) -> Self {
132+
let [$($T,)+] = array;
133+
($($T,)+)
134+
}
132135
}
133136
}
134137

135-
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
136-
impl<T> From<($(${ignore($T)} T,)+)> for [T; ${count($T)}] {
137-
#[inline]
138-
#[allow(non_snake_case)]
139-
fn from(tuple: ($(${ignore($T)} T,)+)) -> Self {
140-
let ($($T,)+) = tuple;
141-
[$($T,)+]
138+
maybe_tuple_doc! {
139+
$($T)+ @
140+
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
141+
impl<T> From<($(${ignore($T)} T,)+)> for [T; ${count($T)}] {
142+
#[inline]
143+
#[allow(non_snake_case)]
144+
fn from(tuple: ($(${ignore($T)} T,)+)) -> Self {
145+
let ($($T,)+) = tuple;
146+
[$($T,)+]
147+
}
142148
}
143149
}
144150
}
@@ -148,7 +154,7 @@ macro_rules! tuple_impls {
148154
// Otherwise, it hides the docs entirely.
149155
macro_rules! maybe_tuple_doc {
150156
($a:ident @ #[$meta:meta] $item:item) => {
151-
#[doc(fake_variadic)]
157+
#[cfg_attr(not(bootstrap), doc(fake_variadic))]
152158
#[doc = "This trait is implemented for tuples up to twelve items long."]
153159
#[$meta]
154160
$item

0 commit comments

Comments
 (0)