@@ -248,12 +248,14 @@ fn add_generics_and_bounds_as_types<'tcx>(
248
248
tcx : TyCtxt < ' tcx > ,
249
249
recurse : usize ,
250
250
res : & mut Vec < TypeWithKind > ,
251
+ cache : & Cache ,
251
252
) {
252
253
fn insert_ty (
253
254
res : & mut Vec < TypeWithKind > ,
254
255
tcx : TyCtxt < ' _ > ,
255
256
ty : Type ,
256
257
mut generics : Vec < TypeWithKind > ,
258
+ cache : & Cache ,
257
259
) {
258
260
let is_full_generic = ty. is_full_generic ( ) ;
259
261
@@ -347,14 +349,15 @@ fn add_generics_and_bounds_as_types<'tcx>(
347
349
tcx,
348
350
recurse + 1 ,
349
351
& mut ty_generics,
352
+ cache,
350
353
)
351
354
}
352
355
_ => { }
353
356
}
354
357
}
355
358
}
356
359
}
357
- insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
360
+ insert_ty ( res, tcx, arg. clone ( ) , ty_generics, cache ) ;
358
361
}
359
362
// Otherwise we check if the trait bounds are "inlined" like `T: Option<u32>`...
360
363
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>(
368
371
tcx,
369
372
recurse + 1 ,
370
373
& mut ty_generics,
374
+ cache,
371
375
) ;
372
376
}
373
377
}
374
- insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
378
+ insert_ty ( res, tcx, arg. clone ( ) , ty_generics, cache ) ;
375
379
}
376
380
} else {
377
381
// 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>(
382
386
let mut ty_generics = Vec :: new ( ) ;
383
387
if let Some ( arg_generics) = arg. generics ( ) {
384
388
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
+ ) ;
386
397
}
387
398
}
388
- insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
399
+ insert_ty ( res, tcx, arg. clone ( ) , ty_generics, cache ) ;
389
400
}
390
401
}
391
402
@@ -407,7 +418,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
407
418
continue ;
408
419
}
409
420
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 ) ;
411
422
if !args. is_empty ( ) {
412
423
all_types. extend ( args) ;
413
424
} else {
@@ -420,7 +431,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
420
431
let mut ret_types = Vec :: new ( ) ;
421
432
match decl. output {
422
433
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 ) ;
424
435
if ret_types. is_empty ( ) {
425
436
if let Some ( kind) = return_type. def_id ( cache) . map ( |did| tcx. def_kind ( did) . into ( ) ) {
426
437
ret_types. push ( TypeWithKind :: from ( ( get_index_type ( return_type, vec ! [ ] ) , kind) ) ) ;
0 commit comments