@@ -248,12 +248,14 @@ fn add_generics_and_bounds_as_types<'tcx>(
248248 tcx : TyCtxt < ' tcx > ,
249249 recurse : usize ,
250250 res : & mut Vec < TypeWithKind > ,
251+ cache : & Cache ,
251252) {
252253 fn insert_ty (
253254 res : & mut Vec < TypeWithKind > ,
254255 tcx : TyCtxt < ' _ > ,
255256 ty : Type ,
256257 mut generics : Vec < TypeWithKind > ,
258+ cache : & Cache ,
257259 ) {
258260 let is_full_generic = ty. is_full_generic ( ) ;
259261
@@ -347,14 +349,15 @@ fn add_generics_and_bounds_as_types<'tcx>(
347349 tcx,
348350 recurse + 1 ,
349351 & mut ty_generics,
352+ cache,
350353 )
351354 }
352355 _ => { }
353356 }
354357 }
355358 }
356359 }
357- insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
360+ insert_ty ( res, tcx, arg. clone ( ) , ty_generics, cache ) ;
358361 }
359362 // Otherwise we check if the trait bounds are "inlined" like `T: Option<u32>`...
360363 if let Some ( bound) = generics. params . iter ( ) . find ( |g| g. is_type ( ) && g. name == arg_s) {
@@ -368,10 +371,11 @@ fn add_generics_and_bounds_as_types<'tcx>(
368371 tcx,
369372 recurse + 1 ,
370373 & mut ty_generics,
374+ cache,
371375 ) ;
372376 }
373377 }
374- insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
378+ insert_ty ( res, tcx, arg. clone ( ) , ty_generics, cache ) ;
375379 }
376380 } else {
377381 // This is not a type parameter. So for example if we have `T, U: Option<T>`, and we're
@@ -382,10 +386,17 @@ fn add_generics_and_bounds_as_types<'tcx>(
382386 let mut ty_generics = Vec :: new ( ) ;
383387 if let Some ( arg_generics) = arg. generics ( ) {
384388 for gen in arg_generics. iter ( ) {
385- add_generics_and_bounds_as_types ( generics, gen, tcx, recurse + 1 , & mut ty_generics) ;
389+ add_generics_and_bounds_as_types (
390+ generics,
391+ gen,
392+ tcx,
393+ recurse + 1 ,
394+ & mut ty_generics,
395+ cache,
396+ ) ;
386397 }
387398 }
388- insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
399+ insert_ty ( res, tcx, arg. clone ( ) , ty_generics, cache ) ;
389400 }
390401}
391402
@@ -407,7 +418,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
407418 continue ;
408419 }
409420 let mut args = Vec :: new ( ) ;
410- add_generics_and_bounds_as_types ( generics, & arg. type_ , tcx, 0 , & mut args) ;
421+ add_generics_and_bounds_as_types ( generics, & arg. type_ , tcx, 0 , & mut args, cache ) ;
411422 if !args. is_empty ( ) {
412423 all_types. extend ( args) ;
413424 } else {
@@ -420,7 +431,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
420431 let mut ret_types = Vec :: new ( ) ;
421432 match decl. output {
422433 FnRetTy :: Return ( ref return_type) => {
423- add_generics_and_bounds_as_types ( generics, return_type, tcx, 0 , & mut ret_types) ;
434+ add_generics_and_bounds_as_types ( generics, return_type, tcx, 0 , & mut ret_types, cache ) ;
424435 if ret_types. is_empty ( ) {
425436 if let Some ( kind) = return_type. def_id ( cache) . map ( |did| tcx. def_kind ( did) . into ( ) ) {
426437 ret_types. push ( TypeWithKind :: from ( ( get_index_type ( return_type, vec ! [ ] ) , kind) ) ) ;
0 commit comments