@@ -208,7 +208,12 @@ pub(super) fn lower_generic_args(
208208 if args. is_empty ( ) && bindings. is_empty ( ) {
209209 return None ;
210210 }
211- Some ( GenericArgs { args, has_self_type : false , bindings, desugared_from_fn : false } )
211+ Some ( GenericArgs {
212+ args,
213+ has_self_type : false ,
214+ bindings : bindings. into_boxed_slice ( ) ,
215+ desugared_from_fn : false ,
216+ } )
212217}
213218
214219/// Collect `GenericArgs` from the parts of a fn-like path, i.e. `Fn(X, Y)
@@ -219,7 +224,6 @@ fn lower_generic_args_from_fn_path(
219224 ret_type : Option < ast:: RetType > ,
220225) -> Option < GenericArgs > {
221226 let mut args = Vec :: new ( ) ;
222- let mut bindings = Vec :: new ( ) ;
223227 let params = params?;
224228 let mut param_types = Vec :: new ( ) ;
225229 for param in params. params ( ) {
@@ -228,23 +232,23 @@ fn lower_generic_args_from_fn_path(
228232 }
229233 let arg = GenericArg :: Type ( TypeRef :: Tuple ( param_types) ) ;
230234 args. push ( arg) ;
231- if let Some ( ret_type) = ret_type {
235+ let bindings = if let Some ( ret_type) = ret_type {
232236 let type_ref = TypeRef :: from_ast_opt ( ctx, ret_type. ty ( ) ) ;
233- bindings . push ( AssociatedTypeBinding {
237+ Box :: new ( [ AssociatedTypeBinding {
234238 name : name ! [ Output ] ,
235239 args : None ,
236240 type_ref : Some ( type_ref) ,
237241 bounds : Box :: default ( ) ,
238- } ) ;
242+ } ] )
239243 } else {
240244 // -> ()
241245 let type_ref = TypeRef :: Tuple ( Vec :: new ( ) ) ;
242- bindings . push ( AssociatedTypeBinding {
246+ Box :: new ( [ AssociatedTypeBinding {
243247 name : name ! [ Output ] ,
244248 args : None ,
245249 type_ref : Some ( type_ref) ,
246250 bounds : Box :: default ( ) ,
247- } ) ;
248- }
251+ } ] )
252+ } ;
249253 Some ( GenericArgs { args, has_self_type : false , bindings, desugared_from_fn : true } )
250254}
0 commit comments