mirror of
https://github.com/rust-lang/rust
synced 2024-10-16 21:43:43 +00:00
Use metavar ${count(x)}
instead of reimplementing it
This commit is contained in:
parent
9fba2622a0
commit
4d04a062c8
|
@ -102,17 +102,17 @@ fn default() -> ($($T,)+) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
|
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
|
||||||
impl<T> From<[T; count!($($T)+)]> for ($(${ignore(T)} T,)+) {
|
impl<T> From<[T; ${count(T)}]> for ($(${ignore(T)} T,)+) {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn from(array: [T; count!($($T)+)]) -> Self {
|
fn from(array: [T; ${count(T)}]) -> Self {
|
||||||
let [$($T,)+] = array;
|
let [$($T,)+] = array;
|
||||||
($($T,)+)
|
($($T,)+)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
|
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
|
||||||
impl<T> From<($(${ignore(T)} T,)+)> for [T; count!($($T)+)] {
|
impl<T> From<($(${ignore(T)} T,)+)> for [T; ${count(T)}] {
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
fn from(tuple: ($(${ignore(T)} T,)+)) -> Self {
|
fn from(tuple: ($(${ignore(T)} T,)+)) -> Self {
|
||||||
|
@ -200,12 +200,6 @@ macro_rules! last_type {
|
||||||
|
|
||||||
tuple_impls!(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);
|
||||||
|
|
||||||
macro_rules! count {
|
|
||||||
($($a:ident)*) => {
|
|
||||||
0 $(${ignore(a)} + 1)*
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
|
#[stable(feature = "array_tuple_conv", since = "1.63.0")]
|
||||||
impl<T> From<()> for [T; 0] {
|
impl<T> From<()> for [T; 0] {
|
||||||
fn from((): ()) -> Self {
|
fn from((): ()) -> Self {
|
||||||
|
|
Loading…
Reference in a new issue