@@ -316,21 +316,28 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
316316 let desc = item. doc_value ( ) . map_or_else ( String :: new, |x| {
317317 short_markdown_summary ( x. as_str ( ) , & item. link_names ( self . cache ) )
318318 } ) ;
319- self . cache . search_index . push ( IndexItem {
320- ty : item. type_ ( ) ,
321- name : s. to_string ( ) ,
322- path : join_with_double_colon ( path) ,
323- desc,
324- parent,
325- parent_idx : None ,
326- search_type : get_function_type_for_search (
327- & item,
328- self . tcx ,
329- clean_impl_generics ( self . cache . parent_stack . last ( ) ) . as_ref ( ) ,
330- self . cache ,
331- ) ,
332- aliases : item. attrs . get_doc_aliases ( ) ,
333- } ) ;
319+ let ty = item. type_ ( ) ;
320+ let name = s. to_string ( ) ;
321+ if ty != ItemType :: StructField || u16:: from_str_radix ( & name, 10 ) . is_err ( ) {
322+ // In case this is a field from a tuple struct, we don't add it into
323+ // the search index because its name is something like "0", which is
324+ // not useful for rustdoc search.
325+ self . cache . search_index . push ( IndexItem {
326+ ty,
327+ name,
328+ path : join_with_double_colon ( path) ,
329+ desc,
330+ parent,
331+ parent_idx : None ,
332+ search_type : get_function_type_for_search (
333+ & item,
334+ self . tcx ,
335+ clean_impl_generics ( self . cache . parent_stack . last ( ) ) . as_ref ( ) ,
336+ self . cache ,
337+ ) ,
338+ aliases : item. attrs . get_doc_aliases ( ) ,
339+ } ) ;
340+ }
334341 }
335342 }
336343 ( Some ( parent) , None ) if is_inherent_impl_item => {
0 commit comments