From e9a5a9d7d5502ac6847328a12c9f319f3bb5a903 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sun, 21 May 2023 04:13:05 +0000 Subject: [PATCH] Don't use inner macro in marker_impls --- library/core/src/marker.rs | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 2bb688b921c..8dab8d1a692 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -43,27 +43,17 @@ /// ``` #[unstable(feature = "internal_impls_macro", issue = "none")] macro marker_impls { - ( $(#[$($meta:tt)*])* $Trait:ident for $( $({$($bounds:tt)*})? $T:ty ),+ $(,)?) => { - // This inner macro is needed because... idk macros are weird. - // It allows repeating `meta` on all impls. - #[unstable(feature = "internal_impls_macro", issue = "none")] - macro _impl { - ( $$({$$($$bounds_:tt)*})? $$T_:ty ) => { - $(#[$($meta)*])* impl<$$($$($$bounds_)*)?> $Trait for $$T_ {} - } - } - $( _impl! { $({$($bounds)*})? $T } )+ + ( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => { + $(#[$($meta)*])* impl< $($($bounds)*)? > $Trait for $T {} + marker_impls! { $(#[$($meta)*])* $Trait for $($($rest)*)? } }, - ( $(#[$($meta:tt)*])* unsafe $Trait:ident for $( $({$($bounds:tt)*})? $T:ty ),+ $(,)?) => { - #[unstable(feature = "internal_impls_macro", issue = "none")] - macro _impl { - ( $$({$$($$bounds_:tt)*})? $$T_:ty ) => { - $(#[$($meta)*])* unsafe impl<$$($$($$bounds_)*)?> $Trait for $$T_ {} - } - } + ( $(#[$($meta:tt)*])* $Trait:ident for ) => {}, - $( _impl! { $({$($bounds)*})? $T } )+ + ( $(#[$($meta:tt)*])* unsafe $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => { + $(#[$($meta)*])* unsafe impl< $($($bounds)*)? > $Trait for $T {} + marker_impls! { $(#[$($meta)*])* unsafe $Trait for $($($rest)*)? } }, + ( $(#[$($meta:tt)*])* unsafe $Trait:ident for ) => {}, } /// Types that can be transferred across thread boundaries.