@@ -503,17 +503,15 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
503
503
// We have a parent, but we don't know where they're
504
504
// defined yet. Wait for later to index this item.
505
505
let impl_generics = clean_impl_generics ( cache. parent_stack . last ( ) ) ;
506
- cache. orphan_impl_items . push ( OrphanImplItem {
507
- parent : parent_did,
508
- item : item. clone ( ) ,
509
- impl_generics,
510
- impl_id : if let Some ( ParentStackItem :: Impl { item_id, .. } ) = cache. parent_stack . last ( )
511
- {
512
- item_id. as_def_id ( )
513
- } else {
514
- None
515
- } ,
516
- } ) ;
506
+ let impl_id = if let Some ( ParentStackItem :: Impl { item_id, .. } ) = cache. parent_stack . last ( )
507
+ {
508
+ item_id. as_def_id ( )
509
+ } else {
510
+ None
511
+ } ;
512
+ let orphan_item =
513
+ OrphanImplItem { parent : parent_did, item : item. clone ( ) , impl_generics, impl_id } ;
514
+ cache. orphan_impl_items . push ( orphan_item) ;
517
515
} else if let Some ( path) = parent_path
518
516
&& ( is_impl_child || !cache. stripped_mod )
519
517
{
@@ -540,32 +538,37 @@ fn add_item_to_search_index(tcx: TyCtxt<'_>, cache: &mut Cache, item: &clean::It
540
538
// In case this is a field from a tuple struct, we don't add it into
541
539
// the search index because its name is something like "0", which is
542
540
// not useful for rustdoc search.
543
- cache. search_index . push ( IndexItem {
541
+ let path = join_with_double_colon ( path) ;
542
+ let impl_id =
543
+ if let Some ( ParentStackItem :: Impl { item_id, .. } ) = cache. parent_stack . last ( ) {
544
+ item_id. as_def_id ( )
545
+ } else {
546
+ None
547
+ } ;
548
+ let search_type = get_function_type_for_search (
549
+ & item,
550
+ tcx,
551
+ clean_impl_generics ( cache. parent_stack . last ( ) ) . as_ref ( ) ,
552
+ parent_did,
553
+ cache,
554
+ ) ;
555
+ let aliases = item. attrs . get_doc_aliases ( ) ;
556
+ let deprecation = item. deprecation ( tcx) ;
557
+ let index_item = IndexItem {
544
558
ty,
545
559
defid,
546
560
name,
547
- path : join_with_double_colon ( path ) ,
561
+ path,
548
562
desc,
549
563
parent : parent_did,
550
564
parent_idx : None ,
551
565
exact_path : None ,
552
- impl_id : if let Some ( ParentStackItem :: Impl { item_id, .. } ) =
553
- cache. parent_stack . last ( )
554
- {
555
- item_id. as_def_id ( )
556
- } else {
557
- None
558
- } ,
559
- search_type : get_function_type_for_search (
560
- & item,
561
- tcx,
562
- clean_impl_generics ( cache. parent_stack . last ( ) ) . as_ref ( ) ,
563
- parent_did,
564
- cache,
565
- ) ,
566
- aliases : item. attrs . get_doc_aliases ( ) ,
567
- deprecation : item. deprecation ( tcx) ,
568
- } ) ;
566
+ impl_id,
567
+ search_type,
568
+ aliases,
569
+ deprecation,
570
+ } ;
571
+ cache. search_index . push ( index_item) ;
569
572
}
570
573
}
571
574
}
0 commit comments