@@ -1176,21 +1176,21 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
11761176 _ => None ,
11771177 } )
11781178 . peekable ( ) ;
1179- if let CtorKind :: Fictive = s. struct_type {
1179+ if let CtorKind :: Fictive | CtorKind :: Fn = s. struct_type {
11801180 if fields. peek ( ) . is_some ( ) {
11811181 write ! (
11821182 w,
11831183 "<h2 id=\" fields\" class=\" fields small-section-header\" >\
1184- Fields{}<a href=\" #fields\" class=\" anchor\" ></a></h2>",
1184+ {}{}<a href=\" #fields\" class=\" anchor\" ></a>\
1185+ </h2>",
1186+ if let CtorKind :: Fictive = s. struct_type { "Fields" } else { "Tuple Fields" } ,
11851187 document_non_exhaustive_header( it)
11861188 ) ;
11871189 document_non_exhaustive ( w, it) ;
1188- for ( field, ty) in fields {
1189- let id = cx. derive_id ( format ! (
1190- "{}.{}" ,
1191- ItemType :: StructField ,
1192- field. name. as_ref( ) . unwrap( )
1193- ) ) ;
1190+ for ( index, ( field, ty) ) in fields. enumerate ( ) {
1191+ let field_name =
1192+ field. name . map_or_else ( || index. to_string ( ) , |sym| ( * sym. as_str ( ) ) . to_string ( ) ) ;
1193+ let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: StructField , field_name) ) ;
11941194 write ! (
11951195 w,
11961196 "<span id=\" {id}\" class=\" {item_type} small-section-header\" >\
@@ -1199,7 +1199,7 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
11991199 </span>",
12001200 item_type = ItemType :: StructField ,
12011201 id = id,
1202- name = field . name . as_ref ( ) . unwrap ( ) ,
1202+ name = field_name ,
12031203 ty = ty. print( cx)
12041204 ) ;
12051205 document ( w, cx, field, Some ( it) ) ;
0 commit comments