@@ -1176,21 +1176,21 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
1176
1176
_ => None ,
1177
1177
} )
1178
1178
. peekable ( ) ;
1179
- if let CtorKind :: Fictive = s. struct_type {
1179
+ if let CtorKind :: Fictive | CtorKind :: Fn = s. struct_type {
1180
1180
if fields. peek ( ) . is_some ( ) {
1181
1181
write ! (
1182
1182
w,
1183
1183
"<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" } ,
1185
1187
document_non_exhaustive_header( it)
1186
1188
) ;
1187
1189
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) ) ;
1194
1194
write ! (
1195
1195
w,
1196
1196
"<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
1199
1199
</span>",
1200
1200
item_type = ItemType :: StructField ,
1201
1201
id = id,
1202
- name = field . name . as_ref ( ) . unwrap ( ) ,
1202
+ name = field_name ,
1203
1203
ty = ty. print( cx)
1204
1204
) ;
1205
1205
document ( w, cx, field, Some ( it) ) ;
0 commit comments