@@ -166,8 +166,8 @@ pub trait MethodImplementation: private::Sealed + Sized {
166166 fn __imp ( self ) -> Imp ;
167167}
168168
169- macro_rules! method_decl_impl {
170- ( @ <$( $l: lifetime) ,* > T : $t_bound: ident $( + $t_bound2: ident) ?, $r: ident, $f: ty, $( $t: ident) ,* ) => {
169+ macro_rules! method_impl_generic {
170+ ( <$( $l: lifetime) ,* > T : $t_bound: ident $( + $t_bound2: ident) ?, $r: ident, $f: ty, $( $t: ident) ,* ) => {
171171 impl <$( $l, ) * T , $r, $( $t) ,* > private:: Sealed for $f
172172 where
173173 T : ?Sized + $t_bound $( + $t_bound2) ?,
@@ -190,7 +190,10 @@ macro_rules! method_decl_impl {
190190 }
191191 }
192192 } ;
193- ( @<$( $l: lifetime) ,* > $callee: ident, $r: ident, $f: ty, $( $t: ident) ,* ) => {
193+ }
194+
195+ macro_rules! method_impl_concrete {
196+ ( <$( $l: lifetime) ,* > $callee: ident, $r: ident, $f: ty, $( $t: ident) ,* ) => {
194197 impl <$( $l, ) * $r, $( $t) ,* > private:: Sealed for $f
195198 where
196199 $r: EncodeReturn ,
@@ -211,7 +214,10 @@ macro_rules! method_decl_impl {
211214 }
212215 }
213216 } ;
214- ( @<> Allocated <T >, $f: ty, $( $t: ident) ,* ) => {
217+ }
218+
219+ macro_rules! method_impl_allocated {
220+ ( <> Allocated <T >, $f: ty, $( $t: ident) ,* ) => {
215221 #[ doc( hidden) ]
216222 impl <T , $( $t) ,* > private:: Sealed for $f
217223 where
@@ -242,48 +248,54 @@ macro_rules! method_decl_impl {
242248 }
243249 }
244250 } ;
245- ( # $abi: literal; $( $t: ident) ,* ) => {
246- method_decl_impl!( @<' a> T : Message , R , extern $abi fn ( & ' a T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
247- method_decl_impl!( @<' a> T : Message + IsMutable , R , extern $abi fn ( & ' a mut T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
248- method_decl_impl!( @<> T : Message , R , unsafe extern $abi fn ( * const T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
249- method_decl_impl!( @<> T : Message , R , unsafe extern $abi fn ( * mut T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
250- method_decl_impl!( @<' a> T : Message , R , unsafe extern $abi fn ( & ' a T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
251- method_decl_impl!( @<' a> T : Message + IsMutable , R , unsafe extern $abi fn ( & ' a mut T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
252-
253- method_decl_impl!( @<' a> AnyObject , R , extern $abi fn ( & ' a mut AnyObject , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
254- method_decl_impl!( @<' a> AnyObject , R , unsafe extern $abi fn ( & ' a mut AnyObject , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
255-
256- method_decl_impl!( @<' a> AnyClass , R , extern $abi fn ( & ' a AnyClass , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
257- method_decl_impl!( @<> AnyClass , R , unsafe extern $abi fn ( * const AnyClass , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
258- method_decl_impl!( @<' a> AnyClass , R , unsafe extern $abi fn ( & ' a AnyClass , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
259-
260- method_decl_impl!( @<> Allocated <T >, extern $abi fn ( Allocated <T >, Sel $( , $t) * ) -> __IdReturnValue, $( $t) ,* ) ;
261- method_decl_impl!( @<> Allocated <T >, unsafe extern $abi fn ( Allocated <T >, Sel $( , $t) * ) -> __IdReturnValue, $( $t) ,* ) ;
251+ }
252+
253+ macro_rules! method_impl_abi {
254+ ( $abi: literal; $( $t: ident) ,* ) => {
255+ method_impl_generic!( <' a> T : Message , R , extern $abi fn ( & ' a T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
256+ method_impl_generic!( <' a> T : Message + IsMutable , R , extern $abi fn ( & ' a mut T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
257+ method_impl_generic!( <> T : Message , R , unsafe extern $abi fn ( * const T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
258+ method_impl_generic!( <> T : Message , R , unsafe extern $abi fn ( * mut T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
259+ method_impl_generic!( <' a> T : Message , R , unsafe extern $abi fn ( & ' a T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
260+ method_impl_generic!( <' a> T : Message + IsMutable , R , unsafe extern $abi fn ( & ' a mut T , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
261+
262+ method_impl_concrete!( <' a> AnyObject , R , extern $abi fn ( & ' a mut AnyObject , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
263+ method_impl_concrete!( <' a> AnyObject , R , unsafe extern $abi fn ( & ' a mut AnyObject , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
264+
265+ method_impl_concrete!( <' a> AnyClass , R , extern $abi fn ( & ' a AnyClass , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
266+ method_impl_concrete!( <> AnyClass , R , unsafe extern $abi fn ( * const AnyClass , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
267+ method_impl_concrete!( <' a> AnyClass , R , unsafe extern $abi fn ( & ' a AnyClass , Sel $( , $t) * ) -> R , $( $t) ,* ) ;
268+
269+ method_impl_allocated!( <> Allocated <T >, extern $abi fn ( Allocated <T >, Sel $( , $t) * ) -> __IdReturnValue, $( $t) ,* ) ;
270+ method_impl_allocated!( <> Allocated <T >, unsafe extern $abi fn ( Allocated <T >, Sel $( , $t) * ) -> __IdReturnValue, $( $t) ,* ) ;
262271 } ;
272+ }
273+
274+ macro_rules! method_impl {
263275 ( $( $t: ident) ,* ) => {
264- method_decl_impl! ( # "C" ; $( $t) ,* ) ;
276+ method_impl_abi! ( "C" ; $( $t) ,* ) ;
265277 #[ cfg( feature = "unstable-c-unwind" ) ]
266- method_decl_impl! ( # "C-unwind" ; $( $t) ,* ) ;
278+ method_impl_abi! ( "C-unwind" ; $( $t) ,* ) ;
267279 } ;
268280}
269281
270- method_decl_impl ! ( ) ;
271- method_decl_impl ! ( A ) ;
272- method_decl_impl ! ( A , B ) ;
273- method_decl_impl ! ( A , B , C ) ;
274- method_decl_impl ! ( A , B , C , D ) ;
275- method_decl_impl ! ( A , B , C , D , E ) ;
276- method_decl_impl ! ( A , B , C , D , E , F ) ;
277- method_decl_impl ! ( A , B , C , D , E , F , G ) ;
278- method_decl_impl ! ( A , B , C , D , E , F , G , H ) ;
279- method_decl_impl ! ( A , B , C , D , E , F , G , H , I ) ;
280- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J ) ;
281- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J , K ) ;
282- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L ) ;
283- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M ) ;
284- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M , N ) ;
285- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M , N , O ) ;
286- method_decl_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M , N , O , P ) ;
282+ method_impl ! ( ) ;
283+ method_impl ! ( A ) ;
284+ method_impl ! ( A , B ) ;
285+ method_impl ! ( A , B , C ) ;
286+ method_impl ! ( A , B , C , D ) ;
287+ method_impl ! ( A , B , C , D , E ) ;
288+ method_impl ! ( A , B , C , D , E , F ) ;
289+ method_impl ! ( A , B , C , D , E , F , G ) ;
290+ method_impl ! ( A , B , C , D , E , F , G , H ) ;
291+ method_impl ! ( A , B , C , D , E , F , G , H , I ) ;
292+ method_impl ! ( A , B , C , D , E , F , G , H , I , J ) ;
293+ method_impl ! ( A , B , C , D , E , F , G , H , I , J , K ) ;
294+ method_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L ) ;
295+ method_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M ) ;
296+ method_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M , N ) ;
297+ method_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M , N , O ) ;
298+ method_impl ! ( A , B , C , D , E , F , G , H , I , J , K , L , M , N , O , P ) ;
287299
288300/// Helper type for implementing `MethodImplementation` with a receiver of
289301/// `Allocated<T>`, without exposing that implementation to users.
0 commit comments