@@ -191,6 +191,12 @@ impl From<DerivableTraits> for Vec<&'static str> {
191
191
}
192
192
}
193
193
194
+ struct VariadicMethodInfo {
195
+ args : Vec < proc_macro2:: TokenStream > ,
196
+ ret : proc_macro2:: TokenStream ,
197
+ exprs : Vec < proc_macro2:: TokenStream > ,
198
+ }
199
+
194
200
struct CodegenResult < ' a > {
195
201
items : Vec < proc_macro2:: TokenStream > ,
196
202
dynamic_items : DynamicItems ,
@@ -239,14 +245,7 @@ struct CodegenResult<'a> {
239
245
/// that name. This lets us give each overload a unique suffix.
240
246
overload_counters : HashMap < String , u32 > ,
241
247
242
- variadic_methods : HashMap <
243
- Ident ,
244
- (
245
- Vec < proc_macro2:: TokenStream > ,
246
- proc_macro2:: TokenStream ,
247
- Vec < proc_macro2:: TokenStream > ,
248
- ) ,
249
- > ,
248
+ variadic_methods : HashMap < Ident , VariadicMethodInfo > ,
250
249
}
251
250
252
251
impl < ' a > CodegenResult < ' a > {
@@ -2497,7 +2496,11 @@ impl MethodCodegen for Method {
2497
2496
* last_arg = quote ! ( var_args: impl VarArgs ) ;
2498
2497
result. variadic_methods . insert (
2499
2498
function_name. clone ( ) ,
2500
- ( args. to_owned ( ) , ret. clone ( ) , exprs. clone ( ) ) ,
2499
+ VariadicMethodInfo {
2500
+ args : args. to_owned ( ) ,
2501
+ ret : ret. clone ( ) ,
2502
+ exprs : exprs. clone ( ) ,
2503
+ } ,
2501
2504
) ;
2502
2505
}
2503
2506
@@ -4442,7 +4445,9 @@ pub(crate) fn codegen(
4442
4445
)
4443
4446
} )
4444
4447
. collect :: < Vec < _ > > ( ) ;
4445
- for ( name, ( args, ret, exprs) ) in result. variadic_methods . drain ( ) {
4448
+ for ( name, VariadicMethodInfo { args, ret, exprs } ) in
4449
+ result. variadic_methods . drain ( )
4450
+ {
4446
4451
let call_name = quote:: format_ident!( "call_{}" , name) ;
4447
4452
methods. push ( quote ! {
4448
4453
unsafe fn #call_name( self , #( #args) , * ) #ret
0 commit comments