Change:
Rustdoc should expose doc comments written on tuple fields: Tagging based on conversation on IRC.
This issue also applies to tuple variant fields:
It promises to be very interesting from a design point of view. We'll to think about how to render this nicely.

Discussion:
fn clean(&self, cx: &mut DocContext<'_>) -> Variant { match self { hir::VariantData::Struct(..) => Variant::Struct(self.clean(cx)), <del> hir::VariantData::Tuple(..) => { Variant::Tuple(self.fields().iter().map(|x| x.ty.clean(cx)).collect()) } </del> <ins> // Important note here: `Variant::Tuple` is used on tuple structs which are not in an // enum (so where converting from `ty::VariantDef`). In case we are in an enum, the kind // is provided by the `Variant` wrapper directly, and since we need the fields' name // (even for a tuple struct variant!), it's simpler to just store it as a // `Variant::Struct` instead of a `Variant::Tuple` (otherwise it would force us to make // a lot of changes when rendering them to generate the name as well). hir::VariantData::Tuple(..) => Variant::Struct(self.clean(cx)), </ins> hir::VariantData::Unit(..) => Variant::CLike, } }

} sidebar.push_str("</div>"); <ins> } else if let CtorKind::Fn = s.struct_type { sidebar .push_str("<h3 class="sidebar-title"><a href="#fields">Tuple Fields</a></h3>"); </ins> } }

write!(w, "<div class="sub-variant" id="{id}">", id = variant_id); write!( w, <del> "<h3>Fields of <b>{name}</b></h3><div>", name = variant.name.as_ref().unwrap() </del> <ins> "<h3>{extra}Fields of <b>{name}</b></h3><div>", extra = if s.struct_type == CtorKind::Fn { "Tuple " } else { "" }, name = variant.name.as_ref().unwrap(), </ins> ); for field in &s.fields { use crate::clean::StructFieldItem;

_ => None, }) .peekable(); <del> if let CtorKind::Fictive = s.struct_type { </del> <ins> if let CtorKind::Fictive | CtorKind::Fn = s.struct_type { </ins> if fields.peek().is_some() { write!( w, "<h2 id="fields" class="fields small-section-header"> <del> Fields{}<a href="#fields" class="anchor"></a></h2>", </del> <ins> {}{}<a href="#fields" class="anchor"></a> </h2>", if let CtorKind::Fictive = s.struct_type { "Fields" } else { "Tuple Fields" }, </ins> document_non_exhaustive_header(it) ); document_non_exhaustive(w, it); <del> for (field, ty) in fields { let id = cx.derive_id(format!( "{}.{}", ItemType::StructField, field.name.as_ref().unwrap() )); </del> <ins> for (index, (field, ty)) in fields.enumerate() { let field_name = field.name.map_or_else(|| index.to_string(), |sym| (*sym.as_str()).to_string()); let id = cx.derive_id(format!("{}.{}", ItemType::StructField, field_name)); </ins> write!( w, "<span id="{id}" class="{item_type} small-section-header">

</span>", item_type = ItemType::StructField, id = id, <del> name = field.name.as_ref().unwrap(), </del> <ins> name = field_name, </ins> ty = ty.print(cx) ); document(w, cx, field, Some(it));

if let Some(g) = g { write!(w, "{}", print_where_clause(g, cx, 0, false),) } <del> w.write_str(";"); </del> <ins> // We only want a ";" when we are displaying a tuple struct, not a variant tuple struct. if structhead { w.write_str(";"); } </ins> } CtorKind::Const => { // Needed for PhantomData.

+-------------------------------------+------------+------------+------------+------------+ | File                                | Documented | Percentage |   Examples | Percentage | +-------------------------------------+------------+------------+------------+------------+ <del> | ...est/rustdoc-ui/coverage/enums.rs |          6 |      75.0% |          0 |       0.0% | </del> <ins> | ...est/rustdoc-ui/coverage/enums.rs |          6 |      66.7% |          0 |       0.0% | </ins> +-------------------------------------+------------+------------+------------+------------+ <del> | Total                               |          6 |      75.0% |          0 |       0.0% | </del> <ins> | Total                               |          6 |      66.7% |          0 |       0.0% | </ins> +-------------------------------------+------------+------------+------------+------------+

} // @has 'toggle_item_contents/enum.LargeEnum.html' <del> // @count - '//details[@class="rustdoc-toggle type-contents-toggle"]' 1 // @has - '//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 13 variants' </del> <ins> // @count - '//*[@class="rust enum"]//details[@class="rustdoc-toggle type-contents-toggle"]' 1 // @has - '//*[@class="rust enum"]//details[@class="rustdoc-toggle type-contents-toggle"]' 'Show 13 variants' </ins> pub enum LargeEnum { A, B, C, D, E, F(u8), G, H, I, J, K, L, M }

<ins> #![crate_name = "foo"] // @has foo/struct.Foo.html // @has - '//h2[@id="fields"]' 'Tuple Fields' // @has - '//h3[@class="sidebar-title"]/a[@href="#fields"]' 'Tuple Fields' // @has - '//*[@id="structfield.0"]' '0: u32' // @has - '//*[@id="main"]/div[@class="docblock"]' 'hello' // @!has - '//*[@id="structfield.1"]' // @has - '//*[@id="structfield.2"]' '2: char' // @has - '//*[@id="structfield.3"]' '3: i8' // @has - '//*[@id="main"]/div[@class="docblock"]' 'not hello' pub struct Foo( /// hello pub u32, char, pub char, /// not hello pub i8, ); // @has foo/enum.Bar.html // @has - '//pre[@class="rust enum"]' 'BarVariant(String),' // @matches - '//*[@id="variant.BarVariant.fields"]/h3' '^Tuple Fields of BarVariant$' // @has - '//*[@id="variant.BarVariant.field.0"]' '0: String' // @has - '//*[@id="variant.BarVariant.fields"]//*[@class="docblock"]' 'Hello docs' // @matches - '//*[@id="variant.FooVariant.fields"]/h3' '^Fields of FooVariant$' pub enum Bar { BarVariant( /// Hello docs String ), FooVariant { /// hello x: u32, }, } </ins>