@@ -1037,8 +1037,9 @@ fn item_enum(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, e: &clean::Enum
10371037 write ! ( w, "<div class=\" sub-variant\" id=\" {id}\" >" , id = variant_id) ;
10381038 write ! (
10391039 w,
1040- "<h3>Fields of <b>{name}</b></h3><div>" ,
1041- name = variant. name. as_ref( ) . unwrap( )
1040+ "<h3>{extra}Fields of <b>{name}</b></h3><div>" ,
1041+ extra = if s. struct_type == CtorKind :: Fn { "Tuple " } else { "" } ,
1042+ name = variant. name. as_ref( ) . unwrap( ) ,
10421043 ) ;
10431044 for field in & s. fields {
10441045 use crate :: clean:: StructFieldItem ;
@@ -1176,21 +1177,21 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
11761177 _ => None ,
11771178 } )
11781179 . peekable ( ) ;
1179- if let CtorKind :: Fictive = s. struct_type {
1180+ if let CtorKind :: Fictive | CtorKind :: Fn = s. struct_type {
11801181 if fields. peek ( ) . is_some ( ) {
11811182 write ! (
11821183 w,
11831184 "<h2 id=\" fields\" class=\" fields small-section-header\" >\
1184- Fields{}<a href=\" #fields\" class=\" anchor\" ></a></h2>",
1185+ {}{}<a href=\" #fields\" class=\" anchor\" ></a>\
1186+ </h2>",
1187+ if let CtorKind :: Fictive = s. struct_type { "Fields" } else { "Tuple Fields" } ,
11851188 document_non_exhaustive_header( it)
11861189 ) ;
11871190 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- ) ) ;
1191+ for ( index, ( field, ty) ) in fields. enumerate ( ) {
1192+ let field_name =
1193+ field. name . map_or_else ( || index. to_string ( ) , |sym| ( * sym. as_str ( ) ) . to_string ( ) ) ;
1194+ let id = cx. derive_id ( format ! ( "{}.{}" , ItemType :: StructField , field_name) ) ;
11941195 write ! (
11951196 w,
11961197 "<span id=\" {id}\" class=\" {item_type} small-section-header\" >\
@@ -1199,7 +1200,7 @@ fn item_struct(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, s: &clean::St
11991200 </span>",
12001201 item_type = ItemType :: StructField ,
12011202 id = id,
1202- name = field . name . as_ref ( ) . unwrap ( ) ,
1203+ name = field_name ,
12031204 ty = ty. print( cx)
12041205 ) ;
12051206 document ( w, cx, field, Some ( it) ) ;
@@ -1507,7 +1508,10 @@ fn render_struct(
15071508 if let Some ( g) = g {
15081509 write ! ( w, "{}" , print_where_clause( g, cx, 0 , false ) , )
15091510 }
1510- w. write_str ( ";" ) ;
1511+ // We only want a ";" when we are displaying a tuple struct, not a variant tuple struct.
1512+ if structhead {
1513+ w. write_str ( ";" ) ;
1514+ }
15111515 }
15121516 CtorKind :: Const => {
15131517 // Needed for PhantomData.
0 commit comments