@@ -32,7 +32,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
32
32
desc,
33
33
parent : Some ( did) ,
34
34
parent_idx : None ,
35
- search_type : get_index_search_type ( item, tcx) ,
35
+ search_type : get_function_type_for_search ( item, tcx) ,
36
36
aliases : item. attrs . get_doc_aliases ( ) ,
37
37
} ) ;
38
38
}
@@ -181,14 +181,14 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
181
181
)
182
182
}
183
183
184
- crate fn get_index_search_type < ' tcx > (
184
+ crate fn get_function_type_for_search < ' tcx > (
185
185
item : & clean:: Item ,
186
186
tcx : TyCtxt < ' tcx > ,
187
187
) -> Option < IndexItemFunctionType > {
188
188
let ( mut inputs, mut output) = match * item. kind {
189
- clean:: FunctionItem ( ref f) => get_all_types ( f, tcx) ,
190
- clean:: MethodItem ( ref m, _) => get_all_types ( m, tcx) ,
191
- clean:: TyMethodItem ( ref m) => get_all_types ( m, tcx) ,
189
+ clean:: FunctionItem ( ref f) => get_fn_inputs_and_outputs ( f, tcx) ,
190
+ clean:: MethodItem ( ref m, _) => get_fn_inputs_and_outputs ( m, tcx) ,
191
+ clean:: TyMethodItem ( ref m) => get_fn_inputs_and_outputs ( m, tcx) ,
192
192
_ => return None ,
193
193
} ;
194
194
@@ -237,7 +237,7 @@ fn get_index_type_name(clean_type: &clean::Type, accept_generic: bool) -> Option
237
237
///
238
238
/// Important note: It goes through generics recursively. So if you have
239
239
/// `T: Option<Result<(), ()>>`, it'll go into `Option` and then into `Result`.
240
- fn get_real_types < ' tcx > (
240
+ fn add_generics_and_bounds_as_types < ' tcx > (
241
241
generics : & Generics ,
242
242
arg : & Type ,
243
243
tcx : TyCtxt < ' tcx > ,
@@ -337,7 +337,13 @@ fn get_real_types<'tcx>(
337
337
for param_def in poly_trait. generic_params . iter ( ) {
338
338
match & param_def. kind {
339
339
clean:: GenericParamDefKind :: Type { default : Some ( ty) , .. } => {
340
- get_real_types ( generics, ty, tcx, recurse + 1 , & mut ty_generics)
340
+ add_generics_and_bounds_as_types (
341
+ generics,
342
+ ty,
343
+ tcx,
344
+ recurse + 1 ,
345
+ & mut ty_generics,
346
+ )
341
347
}
342
348
_ => { }
343
349
}
@@ -352,7 +358,13 @@ fn get_real_types<'tcx>(
352
358
for bound in bound. get_bounds ( ) . unwrap_or ( & [ ] ) {
353
359
if let Some ( path) = bound. get_trait_path ( ) {
354
360
let ty = Type :: Path { path } ;
355
- get_real_types ( generics, & ty, tcx, recurse + 1 , & mut ty_generics) ;
361
+ add_generics_and_bounds_as_types (
362
+ generics,
363
+ & ty,
364
+ tcx,
365
+ recurse + 1 ,
366
+ & mut ty_generics,
367
+ ) ;
356
368
}
357
369
}
358
370
insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
@@ -366,7 +378,7 @@ fn get_real_types<'tcx>(
366
378
let mut ty_generics = Vec :: new ( ) ;
367
379
if let Some ( arg_generics) = arg. generics ( ) {
368
380
for gen in arg_generics. iter ( ) {
369
- get_real_types ( generics, gen, tcx, recurse + 1 , & mut ty_generics) ;
381
+ add_generics_and_bounds_as_types ( generics, gen, tcx, recurse + 1 , & mut ty_generics) ;
370
382
}
371
383
}
372
384
insert_ty ( res, tcx, arg. clone ( ) , ty_generics) ;
@@ -377,7 +389,7 @@ fn get_real_types<'tcx>(
377
389
///
378
390
/// i.e. `fn foo<A: Display, B: Option<A>>(x: u32, y: B)` will return
379
391
/// `[u32, Display, Option]`.
380
- fn get_all_types < ' tcx > (
392
+ fn get_fn_inputs_and_outputs < ' tcx > (
381
393
func : & Function ,
382
394
tcx : TyCtxt < ' tcx > ,
383
395
) -> ( Vec < TypeWithKind > , Vec < TypeWithKind > ) {
@@ -390,7 +402,7 @@ fn get_all_types<'tcx>(
390
402
continue ;
391
403
}
392
404
let mut args = Vec :: new ( ) ;
393
- get_real_types ( generics, & arg. type_ , tcx, 0 , & mut args) ;
405
+ add_generics_and_bounds_as_types ( generics, & arg. type_ , tcx, 0 , & mut args) ;
394
406
if !args. is_empty ( ) {
395
407
all_types. extend ( args) ;
396
408
} else {
@@ -404,7 +416,7 @@ fn get_all_types<'tcx>(
404
416
let mut ret_types = Vec :: new ( ) ;
405
417
match decl. output {
406
418
FnRetTy :: Return ( ref return_type) => {
407
- get_real_types ( generics, return_type, tcx, 0 , & mut ret_types) ;
419
+ add_generics_and_bounds_as_types ( generics, return_type, tcx, 0 , & mut ret_types) ;
408
420
if ret_types. is_empty ( ) {
409
421
if let Some ( kind) =
410
422
return_type. def_id_no_primitives ( ) . map ( |did| tcx. def_kind ( did) . into ( ) )
0 commit comments