Skip to main content

core/
tuple.rs

1// See core/src/primitive_docs.rs for documentation.
2
3use crate::cell::CloneFromCell;
4use crate::cmp::Ordering::{self, *};
5use crate::marker::{ConstParamTy_, StructuralPartialEq};
6use crate::ops::ControlFlow::{self, Break, Continue};
7
8// Recursive macro for implementing n-ary tuple functions and operations
9//
10// Also provides implementations for tuples with lesser arity. For example, tuple_impls!(A B C)
11// will implement everything for (A, B, C), (A, B) and (A,).
12macro_rules! tuple_impls {
13    // Stopping criteria (1-ary tuple)
14    ($T:ident) => {
15        tuple_impls!(@impl $T);
16    };
17    // Running criteria (n-ary tuple, with n >= 2)
18    ($T:ident $( $U:ident )+) => {
19        tuple_impls!($( $U )+);
20        tuple_impls!(@impl $T $( $U )+);
21    };
22    // "Private" internal implementation
23    (@impl $( $T:ident )+) => {
24        maybe_tuple_doc! {
25            $($T)+ @
26            #[stable(feature = "rust1", since = "1.0.0")]
27            #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
28            impl<$($T: [const] PartialEq),+> const PartialEq for ($($T,)+) {
29                #[inline]
30                fn eq(&self, other: &($($T,)+)) -> bool {
31                    $( ${ignore($T)} self.${index()} == other.${index()} )&&+
32                }
33                #[inline]
34                fn ne(&self, other: &($($T,)+)) -> bool {
35                    $( ${ignore($T)} self.${index()} != other.${index()} )||+
36                }
37            }
38        }
39
40        maybe_tuple_doc! {
41            $($T)+ @
42            #[stable(feature = "rust1", since = "1.0.0")]
43            #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
44            impl<$($T: [const] Eq),+> const Eq for ($($T,)+)
45            {}
46        }
47
48        maybe_tuple_doc! {
49            $($T)+ @
50            #[unstable(feature = "adt_const_params", issue = "95174")]
51            #[unstable_feature_bound(unsized_const_params)]
52            impl<$($T: ConstParamTy_),+> ConstParamTy_ for ($($T,)+)
53            {}
54        }
55
56        maybe_tuple_doc! {
57            $($T)+ @
58            #[unstable(feature = "structural_match", issue = "31434")]
59            impl<$($T),+> StructuralPartialEq for ($($T,)+)
60            {}
61        }
62
63        maybe_tuple_doc! {
64            $($T)+ @
65            #[stable(feature = "rust1", since = "1.0.0")]
66            #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
67            impl<$($T: [const] PartialOrd),+> const PartialOrd for ($($T,)+)
68            {
69                #[inline]
70                fn partial_cmp(&self, other: &($($T,)+)) -> Option<Ordering> {
71                    lexical_partial_cmp!($( ${ignore($T)} self.${index()}, other.${index()} ),+)
72                }
73                #[inline]
74                fn lt(&self, other: &($($T,)+)) -> bool {
75                    lexical_ord!(lt, __chaining_lt, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
76                }
77                #[inline]
78                fn le(&self, other: &($($T,)+)) -> bool {
79                    lexical_ord!(le, __chaining_le, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
80                }
81                #[inline]
82                fn ge(&self, other: &($($T,)+)) -> bool {
83                    lexical_ord!(ge, __chaining_ge, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
84                }
85                #[inline]
86                fn gt(&self, other: &($($T,)+)) -> bool {
87                    lexical_ord!(gt, __chaining_gt, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
88                }
89                #[inline]
90                fn __chaining_lt(&self, other: &($($T,)+)) -> ControlFlow<bool> {
91                    lexical_chain!(__chaining_lt, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
92                }
93                #[inline]
94                fn __chaining_le(&self, other: &($($T,)+)) -> ControlFlow<bool> {
95                    lexical_chain!(__chaining_le, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
96                }
97                #[inline]
98                fn __chaining_gt(&self, other: &($($T,)+)) -> ControlFlow<bool> {
99                    lexical_chain!(__chaining_gt, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
100                }
101                #[inline]
102                fn __chaining_ge(&self, other: &($($T,)+)) -> ControlFlow<bool> {
103                    lexical_chain!(__chaining_ge, $( ${ignore($T)} self.${index()}, other.${index()} ),+)
104                }
105            }
106        }
107
108        maybe_tuple_doc! {
109            $($T)+ @
110            #[stable(feature = "rust1", since = "1.0.0")]
111            #[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
112            impl<$($T: [const] Ord),+> const Ord for ($($T,)+)
113            {
114                #[inline]
115                fn cmp(&self, other: &($($T,)+)) -> Ordering {
116                    lexical_cmp!($( ${ignore($T)} self.${index()}, other.${index()} ),+)
117                }
118            }
119        }
120
121        maybe_tuple_doc! {
122            $($T)+ @
123            #[stable(feature = "rust1", since = "1.0.0")]
124            impl<$($T: Default),+> Default for ($($T,)+) {
125                #[inline]
126                fn default() -> ($($T,)+) {
127                    ($({ let x: $T = Default::default(); x},)+)
128                }
129            }
130        }
131
132        maybe_tuple_doc! {
133            $($T)+ @
134            #[stable(feature = "array_tuple_conv", since = "1.71.0")]
135            // can't do const From due to https://github.com/rust-lang/rust/issues/144280
136            impl<T> From<[T; ${count($T)}]> for ($(${ignore($T)} T,)+) {
137                #[inline]
138                #[allow(non_snake_case)]
139                fn from(array: [T; ${count($T)}]) -> Self {
140                    let [$($T,)+] = array;
141                    ($($T,)+)
142                }
143            }
144        }
145
146        maybe_tuple_doc! {
147            $($T)+ @
148            #[stable(feature = "array_tuple_conv", since = "1.71.0")]
149            // can't do const From due to https://github.com/rust-lang/rust/issues/144280
150            impl<T> From<($(${ignore($T)} T,)+)> for [T; ${count($T)}] {
151                #[inline]
152                #[allow(non_snake_case)]
153                fn from(tuple: ($(${ignore($T)} T,)+)) -> Self {
154                    let ($($T,)+) = tuple;
155                    [$($T,)+]
156                }
157            }
158        }
159
160        maybe_tuple_doc! {
161            $($T)+ @
162            // SAFETY: tuples introduce no additional indirection, so they can be copied whenever T
163            // can.
164            #[unstable(feature = "cell_get_cloned", issue = "145329")]
165            unsafe impl<$($T: CloneFromCell),+> CloneFromCell for ($($T,)+)
166            {}
167        }
168    }
169}
170
171// If this is a unary tuple, it adds a doc comment.
172// Otherwise, it hides the docs entirely.
173macro_rules! maybe_tuple_doc {
174    ($a:ident @ #[$meta:meta] $item:item) => {
175        #[doc(fake_variadic)]
176        #[doc = "This trait is implemented for tuples up to twelve items long."]
177        #[$meta]
178        $item
179    };
180    ($a:ident $($rest_a:ident)+ @ #[$meta:meta] $item:item) => {
181        #[doc(hidden)]
182        #[$meta]
183        $item
184    };
185}
186
187// Constructs an expression that performs a lexical ordering using method `$rel`.
188// The values are interleaved, so the macro invocation for
189// `(a1, a2, a3) < (b1, b2, b3)` would be `lexical_ord!(lt, opt_is_lt, a1, b1,
190// a2, b2, a3, b3)` (and similarly for `lexical_cmp`)
191//
192// `$chain_rel` is the chaining method from `PartialOrd` to use for all but the
193// final value, to produce better results for simple primitives.
194macro_rules! lexical_ord {
195    ($rel: ident, $chain_rel: ident, $a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {{
196        match PartialOrd::$chain_rel(&$a, &$b) {
197            Break(val) => val,
198            Continue(()) => lexical_ord!($rel, $chain_rel, $($rest_a, $rest_b),+),
199        }
200    }};
201    ($rel: ident, $chain_rel: ident, $a:expr, $b:expr) => {
202        // Use the specific method for the last element
203        PartialOrd::$rel(&$a, &$b)
204    };
205}
206
207// Same parameter interleaving as `lexical_ord` above
208macro_rules! lexical_chain {
209    ($chain_rel: ident, $a:expr, $b:expr $(,$rest_a:expr, $rest_b:expr)*) => {{
210        PartialOrd::$chain_rel(&$a, &$b)?;
211        lexical_chain!($chain_rel $(,$rest_a, $rest_b)*)
212    }};
213    ($chain_rel: ident) => {
214        Continue(())
215    };
216}
217
218macro_rules! lexical_partial_cmp {
219    ($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
220        match ($a).partial_cmp(&$b) {
221            Some(Equal) => lexical_partial_cmp!($($rest_a, $rest_b),+),
222            ordering => ordering
223        }
224    };
225    ($a:expr, $b:expr) => { ($a).partial_cmp(&$b) };
226}
227
228macro_rules! lexical_cmp {
229    ($a:expr, $b:expr, $($rest_a:expr, $rest_b:expr),+) => {
230        match ($a).cmp(&$b) {
231            Equal => lexical_cmp!($($rest_a, $rest_b),+),
232            ordering => ordering
233        }
234    };
235    ($a:expr, $b:expr) => { ($a).cmp(&$b) };
236}
237
238#[doc(hidden)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<E: [const] PartialEq, D: [const] PartialEq, C: [const] PartialEq,
    B: [const] PartialEq, A: [const] PartialEq, Z: [const] PartialEq,
    Y: [const] PartialEq, X: [const] PartialEq, W: [const] PartialEq,
    V: [const] PartialEq, U: [const] PartialEq, T: [const] PartialEq>
    const PartialEq for (E, D, C, B, A, Z, Y, X, W, V, U, T) {
    #[inline]
    fn eq(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> bool {
        self.0 == other.0 && self.1 == other.1 && self.2 == other.2 &&
                                            self.3 == other.3 && self.4 == other.4 && self.5 == other.5
                                && self.6 == other.6 && self.7 == other.7 &&
                        self.8 == other.8 && self.9 == other.9 &&
                self.10 == other.10 && self.11 == other.11
    }
    #[inline]
    fn ne(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> bool {
        self.0 != other.0 || self.1 != other.1 || self.2 != other.2 ||
                                            self.3 != other.3 || self.4 != other.4 || self.5 != other.5
                                || self.6 != other.6 || self.7 != other.7 ||
                        self.8 != other.8 || self.9 != other.9 ||
                self.10 != other.10 || self.11 != other.11
    }
}
#[doc(hidden)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<E: [const] Eq, D: [const] Eq, C: [const] Eq, B: [const] Eq, A: [const]
    Eq, Z: [const] Eq, Y: [const] Eq, X: [const] Eq, W: [const] Eq, V: [const]
    Eq, U: [const] Eq, T: [const] Eq> const Eq for
    (E, D, C, B, A, Z, Y, X, W, V, U, T) {
}
#[doc(hidden)]
#[unstable(feature = "adt_const_params", issue = "95174")]
#[unstable_feature_bound(unsized_const_params)]
impl<E: ConstParamTy_, D: ConstParamTy_, C: ConstParamTy_, B: ConstParamTy_,
    A: ConstParamTy_, Z: ConstParamTy_, Y: ConstParamTy_, X: ConstParamTy_,
    W: ConstParamTy_, V: ConstParamTy_, U: ConstParamTy_, T: ConstParamTy_>
    ConstParamTy_ for (E, D, C, B, A, Z, Y, X, W, V, U, T) {
}
#[doc(hidden)]
#[unstable(feature = "structural_match", issue = "31434")]
impl<E, D, C, B, A, Z, Y, X, W, V, U, T> StructuralPartialEq for
    (E, D, C, B, A, Z, Y, X, W, V, U, T) {
}
#[doc(hidden)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<E: [const] PartialOrd, D: [const] PartialOrd, C: [const] PartialOrd,
    B: [const] PartialOrd, A: [const] PartialOrd, Z: [const] PartialOrd,
    Y: [const] PartialOrd, X: [const] PartialOrd, W: [const] PartialOrd,
    V: [const] PartialOrd, U: [const] PartialOrd, T: [const] PartialOrd>
    const PartialOrd for (E, D, C, B, A, Z, Y, X, W, V, U, T) {
    #[inline]
    fn partial_cmp(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T))
        -> Option<Ordering> {
        match (self.0).partial_cmp(&other.0) {
            Some(Equal) =>
                match (self.1).partial_cmp(&other.1) {
                    Some(Equal) =>
                        match (self.2).partial_cmp(&other.2) {
                            Some(Equal) =>
                                match (self.3).partial_cmp(&other.3) {
                                    Some(Equal) =>
                                        match (self.4).partial_cmp(&other.4) {
                                            Some(Equal) =>
                                                match (self.5).partial_cmp(&other.5) {
                                                    Some(Equal) =>
                                                        match (self.6).partial_cmp(&other.6) {
                                                            Some(Equal) =>
                                                                match (self.7).partial_cmp(&other.7) {
                                                                    Some(Equal) =>
                                                                        match (self.8).partial_cmp(&other.8) {
                                                                            Some(Equal) =>
                                                                                match (self.9).partial_cmp(&other.9) {
                                                                                    Some(Equal) =>
                                                                                        match (self.10).partial_cmp(&other.10) {
                                                                                            Some(Equal) => (self.11).partial_cmp(&other.11),
                                                                                            ordering => ordering,
                                                                                        },
                                                                                    ordering => ordering,
                                                                                },
                                                                            ordering => ordering,
                                                                        },
                                                                    ordering => ordering,
                                                                },
                                                            ordering => ordering,
                                                        },
                                                    ordering => ordering,
                                                },
                                            ordering => ordering,
                                        },
                                    ordering => ordering,
                                },
                            ordering => ordering,
                        },
                    ordering => ordering,
                },
            ordering => ordering,
        }
    }
    #[inline]
    fn lt(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> bool {
        {
            match PartialOrd::__chaining_lt(&self.0, &other.0) {
                Break(val) => val,
                Continue(()) => {
                    match PartialOrd::__chaining_lt(&self.1, &other.1) {
                        Break(val) => val,
                        Continue(()) => {
                            match PartialOrd::__chaining_lt(&self.2, &other.2) {
                                Break(val) => val,
                                Continue(()) => {
                                    match PartialOrd::__chaining_lt(&self.3, &other.3) {
                                        Break(val) => val,
                                        Continue(()) => {
                                            match PartialOrd::__chaining_lt(&self.4, &other.4) {
                                                Break(val) => val,
                                                Continue(()) => {
                                                    match PartialOrd::__chaining_lt(&self.5, &other.5) {
                                                        Break(val) => val,
                                                        Continue(()) => {
                                                            match PartialOrd::__chaining_lt(&self.6, &other.6) {
                                                                Break(val) => val,
                                                                Continue(()) => {
                                                                    match PartialOrd::__chaining_lt(&self.7, &other.7) {
                                                                        Break(val) => val,
                                                                        Continue(()) => {
                                                                            match PartialOrd::__chaining_lt(&self.8, &other.8) {
                                                                                Break(val) => val,
                                                                                Continue(()) => {
                                                                                    match PartialOrd::__chaining_lt(&self.9, &other.9) {
                                                                                        Break(val) => val,
                                                                                        Continue(()) => {
                                                                                            match PartialOrd::__chaining_lt(&self.10, &other.10) {
                                                                                                Break(val) => val,
                                                                                                Continue(()) => PartialOrd::lt(&self.11, &other.11),
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn le(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> bool {
        {
            match PartialOrd::__chaining_le(&self.0, &other.0) {
                Break(val) => val,
                Continue(()) => {
                    match PartialOrd::__chaining_le(&self.1, &other.1) {
                        Break(val) => val,
                        Continue(()) => {
                            match PartialOrd::__chaining_le(&self.2, &other.2) {
                                Break(val) => val,
                                Continue(()) => {
                                    match PartialOrd::__chaining_le(&self.3, &other.3) {
                                        Break(val) => val,
                                        Continue(()) => {
                                            match PartialOrd::__chaining_le(&self.4, &other.4) {
                                                Break(val) => val,
                                                Continue(()) => {
                                                    match PartialOrd::__chaining_le(&self.5, &other.5) {
                                                        Break(val) => val,
                                                        Continue(()) => {
                                                            match PartialOrd::__chaining_le(&self.6, &other.6) {
                                                                Break(val) => val,
                                                                Continue(()) => {
                                                                    match PartialOrd::__chaining_le(&self.7, &other.7) {
                                                                        Break(val) => val,
                                                                        Continue(()) => {
                                                                            match PartialOrd::__chaining_le(&self.8, &other.8) {
                                                                                Break(val) => val,
                                                                                Continue(()) => {
                                                                                    match PartialOrd::__chaining_le(&self.9, &other.9) {
                                                                                        Break(val) => val,
                                                                                        Continue(()) => {
                                                                                            match PartialOrd::__chaining_le(&self.10, &other.10) {
                                                                                                Break(val) => val,
                                                                                                Continue(()) => PartialOrd::le(&self.11, &other.11),
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn ge(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> bool {
        {
            match PartialOrd::__chaining_ge(&self.0, &other.0) {
                Break(val) => val,
                Continue(()) => {
                    match PartialOrd::__chaining_ge(&self.1, &other.1) {
                        Break(val) => val,
                        Continue(()) => {
                            match PartialOrd::__chaining_ge(&self.2, &other.2) {
                                Break(val) => val,
                                Continue(()) => {
                                    match PartialOrd::__chaining_ge(&self.3, &other.3) {
                                        Break(val) => val,
                                        Continue(()) => {
                                            match PartialOrd::__chaining_ge(&self.4, &other.4) {
                                                Break(val) => val,
                                                Continue(()) => {
                                                    match PartialOrd::__chaining_ge(&self.5, &other.5) {
                                                        Break(val) => val,
                                                        Continue(()) => {
                                                            match PartialOrd::__chaining_ge(&self.6, &other.6) {
                                                                Break(val) => val,
                                                                Continue(()) => {
                                                                    match PartialOrd::__chaining_ge(&self.7, &other.7) {
                                                                        Break(val) => val,
                                                                        Continue(()) => {
                                                                            match PartialOrd::__chaining_ge(&self.8, &other.8) {
                                                                                Break(val) => val,
                                                                                Continue(()) => {
                                                                                    match PartialOrd::__chaining_ge(&self.9, &other.9) {
                                                                                        Break(val) => val,
                                                                                        Continue(()) => {
                                                                                            match PartialOrd::__chaining_ge(&self.10, &other.10) {
                                                                                                Break(val) => val,
                                                                                                Continue(()) => PartialOrd::ge(&self.11, &other.11),
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn gt(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> bool {
        {
            match PartialOrd::__chaining_gt(&self.0, &other.0) {
                Break(val) => val,
                Continue(()) => {
                    match PartialOrd::__chaining_gt(&self.1, &other.1) {
                        Break(val) => val,
                        Continue(()) => {
                            match PartialOrd::__chaining_gt(&self.2, &other.2) {
                                Break(val) => val,
                                Continue(()) => {
                                    match PartialOrd::__chaining_gt(&self.3, &other.3) {
                                        Break(val) => val,
                                        Continue(()) => {
                                            match PartialOrd::__chaining_gt(&self.4, &other.4) {
                                                Break(val) => val,
                                                Continue(()) => {
                                                    match PartialOrd::__chaining_gt(&self.5, &other.5) {
                                                        Break(val) => val,
                                                        Continue(()) => {
                                                            match PartialOrd::__chaining_gt(&self.6, &other.6) {
                                                                Break(val) => val,
                                                                Continue(()) => {
                                                                    match PartialOrd::__chaining_gt(&self.7, &other.7) {
                                                                        Break(val) => val,
                                                                        Continue(()) => {
                                                                            match PartialOrd::__chaining_gt(&self.8, &other.8) {
                                                                                Break(val) => val,
                                                                                Continue(()) => {
                                                                                    match PartialOrd::__chaining_gt(&self.9, &other.9) {
                                                                                        Break(val) => val,
                                                                                        Continue(()) => {
                                                                                            match PartialOrd::__chaining_gt(&self.10, &other.10) {
                                                                                                Break(val) => val,
                                                                                                Continue(()) => PartialOrd::gt(&self.11, &other.11),
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn __chaining_lt(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T))
        -> ControlFlow<bool> {
        {
            PartialOrd::__chaining_lt(&self.0, &other.0)?;
            {
                PartialOrd::__chaining_lt(&self.1, &other.1)?;
                {
                    PartialOrd::__chaining_lt(&self.2, &other.2)?;
                    {
                        PartialOrd::__chaining_lt(&self.3, &other.3)?;
                        {
                            PartialOrd::__chaining_lt(&self.4, &other.4)?;
                            {
                                PartialOrd::__chaining_lt(&self.5, &other.5)?;
                                {
                                    PartialOrd::__chaining_lt(&self.6, &other.6)?;
                                    {
                                        PartialOrd::__chaining_lt(&self.7, &other.7)?;
                                        {
                                            PartialOrd::__chaining_lt(&self.8, &other.8)?;
                                            {
                                                PartialOrd::__chaining_lt(&self.9, &other.9)?;
                                                {
                                                    PartialOrd::__chaining_lt(&self.10, &other.10)?;
                                                    {
                                                        PartialOrd::__chaining_lt(&self.11, &other.11)?;
                                                        Continue(())
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn __chaining_le(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T))
        -> ControlFlow<bool> {
        {
            PartialOrd::__chaining_le(&self.0, &other.0)?;
            {
                PartialOrd::__chaining_le(&self.1, &other.1)?;
                {
                    PartialOrd::__chaining_le(&self.2, &other.2)?;
                    {
                        PartialOrd::__chaining_le(&self.3, &other.3)?;
                        {
                            PartialOrd::__chaining_le(&self.4, &other.4)?;
                            {
                                PartialOrd::__chaining_le(&self.5, &other.5)?;
                                {
                                    PartialOrd::__chaining_le(&self.6, &other.6)?;
                                    {
                                        PartialOrd::__chaining_le(&self.7, &other.7)?;
                                        {
                                            PartialOrd::__chaining_le(&self.8, &other.8)?;
                                            {
                                                PartialOrd::__chaining_le(&self.9, &other.9)?;
                                                {
                                                    PartialOrd::__chaining_le(&self.10, &other.10)?;
                                                    {
                                                        PartialOrd::__chaining_le(&self.11, &other.11)?;
                                                        Continue(())
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn __chaining_gt(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T))
        -> ControlFlow<bool> {
        {
            PartialOrd::__chaining_gt(&self.0, &other.0)?;
            {
                PartialOrd::__chaining_gt(&self.1, &other.1)?;
                {
                    PartialOrd::__chaining_gt(&self.2, &other.2)?;
                    {
                        PartialOrd::__chaining_gt(&self.3, &other.3)?;
                        {
                            PartialOrd::__chaining_gt(&self.4, &other.4)?;
                            {
                                PartialOrd::__chaining_gt(&self.5, &other.5)?;
                                {
                                    PartialOrd::__chaining_gt(&self.6, &other.6)?;
                                    {
                                        PartialOrd::__chaining_gt(&self.7, &other.7)?;
                                        {
                                            PartialOrd::__chaining_gt(&self.8, &other.8)?;
                                            {
                                                PartialOrd::__chaining_gt(&self.9, &other.9)?;
                                                {
                                                    PartialOrd::__chaining_gt(&self.10, &other.10)?;
                                                    {
                                                        PartialOrd::__chaining_gt(&self.11, &other.11)?;
                                                        Continue(())
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    #[inline]
    fn __chaining_ge(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T))
        -> ControlFlow<bool> {
        {
            PartialOrd::__chaining_ge(&self.0, &other.0)?;
            {
                PartialOrd::__chaining_ge(&self.1, &other.1)?;
                {
                    PartialOrd::__chaining_ge(&self.2, &other.2)?;
                    {
                        PartialOrd::__chaining_ge(&self.3, &other.3)?;
                        {
                            PartialOrd::__chaining_ge(&self.4, &other.4)?;
                            {
                                PartialOrd::__chaining_ge(&self.5, &other.5)?;
                                {
                                    PartialOrd::__chaining_ge(&self.6, &other.6)?;
                                    {
                                        PartialOrd::__chaining_ge(&self.7, &other.7)?;
                                        {
                                            PartialOrd::__chaining_ge(&self.8, &other.8)?;
                                            {
                                                PartialOrd::__chaining_ge(&self.9, &other.9)?;
                                                {
                                                    PartialOrd::__chaining_ge(&self.10, &other.10)?;
                                                    {
                                                        PartialOrd::__chaining_ge(&self.11, &other.11)?;
                                                        Continue(())
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
#[doc(hidden)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl<E: [const] Ord, D: [const] Ord, C: [const] Ord, B: [const] Ord,
    A: [const] Ord, Z: [const] Ord, Y: [const] Ord, X: [const] Ord, W: [const]
    Ord, V: [const] Ord, U: [const] Ord, T: [const] Ord> const Ord for
    (E, D, C, B, A, Z, Y, X, W, V, U, T) {
    #[inline]
    fn cmp(&self, other: &(E, D, C, B, A, Z, Y, X, W, V, U, T)) -> Ordering {
        match (self.0).cmp(&other.0) {
            Equal =>
                match (self.1).cmp(&other.1) {
                    Equal =>
                        match (self.2).cmp(&other.2) {
                            Equal =>
                                match (self.3).cmp(&other.3) {
                                    Equal =>
                                        match (self.4).cmp(&other.4) {
                                            Equal =>
                                                match (self.5).cmp(&other.5) {
                                                    Equal =>
                                                        match (self.6).cmp(&other.6) {
                                                            Equal =>
                                                                match (self.7).cmp(&other.7) {
                                                                    Equal =>
                                                                        match (self.8).cmp(&other.8) {
                                                                            Equal =>
                                                                                match (self.9).cmp(&other.9) {
                                                                                    Equal =>
                                                                                        match (self.10).cmp(&other.10) {
                                                                                            Equal => (self.11).cmp(&other.11),
                                                                                            ordering => ordering,
                                                                                        },
                                                                                    ordering => ordering,
                                                                                },
                                                                            ordering => ordering,
                                                                        },
                                                                    ordering => ordering,
                                                                },
                                                            ordering => ordering,
                                                        },
                                                    ordering => ordering,
                                                },
                                            ordering => ordering,
                                        },
                                    ordering => ordering,
                                },
                            ordering => ordering,
                        },
                    ordering => ordering,
                },
            ordering => ordering,
        }
    }
}
#[doc(hidden)]
#[stable(feature = "rust1", since = "1.0.0")]
impl<E: Default, D: Default, C: Default, B: Default, A: Default, Z: Default,
    Y: Default, X: Default, W: Default, V: Default, U: Default, T: Default>
    Default for (E, D, C, B, A, Z, Y, X, W, V, U, T) {
    #[inline]
    fn default() -> (E, D, C, B, A, Z, Y, X, W, V, U, T) {
        ({ let x: E = Default::default(); x },
            { let x: D = Default::default(); x },
            { let x: C = Default::default(); x },
            { let x: B = Default::default(); x },
            { let x: A = Default::default(); x },
            { let x: Z = Default::default(); x },
            { let x: Y = Default::default(); x },
            { let x: X = Default::default(); x },
            { let x: W = Default::default(); x },
            { let x: V = Default::default(); x },
            { let x: U = Default::default(); x },
            { let x: T = Default::default(); x })
    }
}
#[doc(hidden)]
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
impl<T> From<[T; 12]> for (T, T, T, T, T, T, T, T, T, T, T, T) {
    #[inline]
    #[allow(non_snake_case)]
    fn from(array: [T; 12]) -> Self {
        let [E, D, C, B, A, Z, Y, X, W, V, U, T] = array;
        (E, D, C, B, A, Z, Y, X, W, V, U, T)
    }
}
#[doc(hidden)]
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
impl<T> From<(T, T, T, T, T, T, T, T, T, T, T, T)> for [T; 12] {
    #[inline]
    #[allow(non_snake_case)]
    fn from(tuple: (T, T, T, T, T, T, T, T, T, T, T, T)) -> Self {
        let (E, D, C, B, A, Z, Y, X, W, V, U, T) = tuple;
        [E, D, C, B, A, Z, Y, X, W, V, U, T]
    }
}
#[doc(hidden)]
#[unstable(feature = "cell_get_cloned", issue = "145329")]
unsafe impl<E: CloneFromCell, D: CloneFromCell, C: CloneFromCell,
    B: CloneFromCell, A: CloneFromCell, Z: CloneFromCell, Y: CloneFromCell,
    X: CloneFromCell, W: CloneFromCell, V: CloneFromCell, U: CloneFromCell,
    T: CloneFromCell> CloneFromCell for (E, D, C, B, A, Z, Y, X, W, V, U, T) {
}tuple_impls!(E D C B A Z Y X W V U T);