@@ -33,7 +33,7 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
33
33
desc,
34
34
parent : Some ( did) ,
35
35
parent_idx : None ,
36
- search_type : get_function_type_for_search ( item, tcx) ,
36
+ search_type : get_function_type_for_search ( item, tcx, & cache ) ,
37
37
aliases : item. attrs . get_doc_aliases ( ) ,
38
38
} ) ;
39
39
}
@@ -188,11 +188,12 @@ crate fn build_index<'tcx>(krate: &clean::Crate, cache: &mut Cache, tcx: TyCtxt<
188
188
crate fn get_function_type_for_search < ' tcx > (
189
189
item : & clean:: Item ,
190
190
tcx : TyCtxt < ' tcx > ,
191
+ cache : & Cache ,
191
192
) -> Option < IndexItemFunctionType > {
192
193
let ( mut inputs, mut output) = match * item. kind {
193
- clean:: FunctionItem ( ref f) => get_fn_inputs_and_outputs ( f, tcx) ,
194
- clean:: MethodItem ( ref m, _) => get_fn_inputs_and_outputs ( m, tcx) ,
195
- clean:: TyMethodItem ( ref m) => get_fn_inputs_and_outputs ( m, tcx) ,
194
+ clean:: FunctionItem ( ref f) => get_fn_inputs_and_outputs ( f, tcx, cache ) ,
195
+ clean:: MethodItem ( ref m, _) => get_fn_inputs_and_outputs ( m, tcx, cache ) ,
196
+ clean:: TyMethodItem ( ref m) => get_fn_inputs_and_outputs ( m, tcx, cache ) ,
196
197
_ => return None ,
197
198
} ;
198
199
@@ -311,7 +312,7 @@ fn add_generics_and_bounds_as_types<'tcx>(
311
312
// We remove the name of the full generic because we have no use for it.
312
313
index_ty. name = Some ( String :: new ( ) ) ;
313
314
res. push ( TypeWithKind :: from ( ( index_ty, ItemType :: Generic ) ) ) ;
314
- } else if let Some ( kind) = ty. def_id_no_primitives ( ) . map ( |did| tcx. def_kind ( did) . into ( ) ) {
315
+ } else if let Some ( kind) = ty. def_id ( cache ) . map ( |did| tcx. def_kind ( did) . into ( ) ) {
315
316
res. push ( TypeWithKind :: from ( ( index_ty, kind) ) ) ;
316
317
} else if ty. is_primitive ( ) {
317
318
// This is a primitive, let's store it as such.
@@ -330,9 +331,7 @@ fn add_generics_and_bounds_as_types<'tcx>(
330
331
if let Type :: Generic ( arg_s) = * arg {
331
332
// First we check if the bounds are in a `where` predicate...
332
333
if let Some ( where_pred) = generics. where_predicates . iter ( ) . find ( |g| match g {
333
- WherePredicate :: BoundPredicate { ty, .. } => {
334
- ty. def_id_no_primitives ( ) == arg. def_id_no_primitives ( )
335
- }
334
+ WherePredicate :: BoundPredicate { ty, .. } => ty. def_id ( cache) == arg. def_id ( cache) ,
336
335
_ => false ,
337
336
} ) {
338
337
let mut ty_generics = Vec :: new ( ) ;
@@ -397,6 +396,7 @@ fn add_generics_and_bounds_as_types<'tcx>(
397
396
fn get_fn_inputs_and_outputs < ' tcx > (
398
397
func : & Function ,
399
398
tcx : TyCtxt < ' tcx > ,
399
+ cache : & Cache ,
400
400
) -> ( Vec < TypeWithKind > , Vec < TypeWithKind > ) {
401
401
let decl = & func. decl ;
402
402
let generics = & func. generics ;
@@ -411,8 +411,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
411
411
if !args. is_empty ( ) {
412
412
all_types. extend ( args) ;
413
413
} else {
414
- if let Some ( kind) = arg. type_ . def_id_no_primitives ( ) . map ( |did| tcx. def_kind ( did) . into ( ) )
415
- {
414
+ if let Some ( kind) = arg. type_ . def_id ( cache) . map ( |did| tcx. def_kind ( did) . into ( ) ) {
416
415
all_types. push ( TypeWithKind :: from ( ( get_index_type ( & arg. type_ , vec ! [ ] ) , kind) ) ) ;
417
416
}
418
417
}
@@ -423,9 +422,7 @@ fn get_fn_inputs_and_outputs<'tcx>(
423
422
FnRetTy :: Return ( ref return_type) => {
424
423
add_generics_and_bounds_as_types ( generics, return_type, tcx, 0 , & mut ret_types) ;
425
424
if ret_types. is_empty ( ) {
426
- if let Some ( kind) =
427
- return_type. def_id_no_primitives ( ) . map ( |did| tcx. def_kind ( did) . into ( ) )
428
- {
425
+ if let Some ( kind) = return_type. def_id ( cache) . map ( |did| tcx. def_kind ( did) . into ( ) ) {
429
426
ret_types. push ( TypeWithKind :: from ( ( get_index_type ( return_type, vec ! [ ] ) , kind) ) ) ;
430
427
}
431
428
}
0 commit comments