Don't use inner macro in marker_impls
This commit is contained in:
parent
1b67f8b013
commit
e9a5a9d7d5
@ -43,27 +43,17 @@
|
|||||||
/// ```
|
/// ```
|
||||||
#[unstable(feature = "internal_impls_macro", issue = "none")]
|
#[unstable(feature = "internal_impls_macro", issue = "none")]
|
||||||
macro marker_impls {
|
macro marker_impls {
|
||||||
( $(#[$($meta:tt)*])* $Trait:ident for $( $({$($bounds:tt)*})? $T:ty ),+ $(,)?) => {
|
( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => {
|
||||||
// This inner macro is needed because... idk macros are weird.
|
$(#[$($meta)*])* impl< $($($bounds)*)? > $Trait for $T {}
|
||||||
// It allows repeating `meta` on all impls.
|
marker_impls! { $(#[$($meta)*])* $Trait for $($($rest)*)? }
|
||||||
#[unstable(feature = "internal_impls_macro", issue = "none")]
|
|
||||||
macro _impl {
|
|
||||||
( $$({$$($$bounds_:tt)*})? $$T_:ty ) => {
|
|
||||||
$(#[$($meta)*])* impl<$$($$($$bounds_)*)?> $Trait for $$T_ {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$( _impl! { $({$($bounds)*})? $T } )+
|
|
||||||
},
|
},
|
||||||
( $(#[$($meta:tt)*])* unsafe $Trait:ident for $( $({$($bounds:tt)*})? $T:ty ),+ $(,)?) => {
|
( $(#[$($meta:tt)*])* $Trait:ident for ) => {},
|
||||||
#[unstable(feature = "internal_impls_macro", issue = "none")]
|
|
||||||
macro _impl {
|
|
||||||
( $$({$$($$bounds_:tt)*})? $$T_:ty ) => {
|
|
||||||
$(#[$($meta)*])* unsafe impl<$$($$($$bounds_)*)?> $Trait for $$T_ {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$( _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.
|
/// Types that can be transferred across thread boundaries.
|
||||||
|
Loading…
Reference in New Issue
Block a user