about summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-01-22 14:30:16 +0000
committerGitHub <noreply@github.com>2021-01-22 14:30:16 +0000
commit2ceee724270f2186e5e85acff49acd35bf8a652a (patch)
treebfa6e0acd7028f38e9327aa3b8d037b308d2b41f /src/librustdoc/html/render
parent1cc13b4f5a576e4517813ca47de316271f1e26b3 (diff)
parent3349b40d471bea1e1b154213b19fbeb5a965943c (diff)
downloadrust-2ceee724270f2186e5e85acff49acd35bf8a652a.tar.gz
rust-2ceee724270f2186e5e85acff49acd35bf8a652a.zip
Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514
Remove doctree::StructType

Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`.

r? `@jyn514`
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 37a0f7f4d7c..6167b75ee50 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -52,6 +52,7 @@ use rustc_attr::{Deprecation, StabilityLevel};
 use rustc_data_structures::flock;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_hir as hir;
+use rustc_hir::def::CtorKind;
 use rustc_hir::def_id::{DefId, LOCAL_CRATE};
 use rustc_hir::Mutability;
 use rustc_middle::middle::stability;
@@ -67,7 +68,6 @@ use serde::{Serialize, Serializer};
 use crate::clean::{self, AttributesExt, GetDefId, RenderedLink, SelfTy, TypeKind};
 use crate::config::{RenderInfo, RenderOptions};
 use crate::docfs::{DocFS, PathError};
-use crate::doctree;
 use crate::error::Error;
 use crate::formats::cache::{cache, Cache};
 use crate::formats::item_type::ItemType;
@@ -3103,7 +3103,7 @@ fn item_struct(
             _ => None,
         })
         .peekable();
-    if let doctree::Plain = s.struct_type {
+    if let CtorKind::Fictive = s.struct_type {
         if fields.peek().is_some() {
             write!(
                 w,
@@ -3353,7 +3353,7 @@ fn render_struct(
     w: &mut Buffer,
     it: &clean::Item,
     g: Option<&clean::Generics>,
-    ty: doctree::StructType,
+    ty: CtorKind,
     fields: &[clean::Item],
     tab: &str,
     structhead: bool,
@@ -3370,7 +3370,7 @@ fn render_struct(
         write!(w, "{}", g.print())
     }
     match ty {
-        doctree::Plain => {
+        CtorKind::Fictive => {
             if let Some(g) = g {
                 write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: true })
             }
@@ -3402,7 +3402,7 @@ fn render_struct(
             }
             write!(w, "}}");
         }
-        doctree::Tuple => {
+        CtorKind::Fn => {
             write!(w, "(");
             for (i, field) in fields.iter().enumerate() {
                 if i > 0 {
@@ -3427,7 +3427,7 @@ fn render_struct(
             }
             write!(w, ";");
         }
-        doctree::Unit => {
+        CtorKind::Const => {
             // Needed for PhantomData.
             if let Some(g) = g {
                 write!(w, "{}", WhereClause { gens: g, indent: 0, end_newline: false })
@@ -4462,7 +4462,7 @@ fn sidebar_struct(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, s: &clea
     let fields = get_struct_fields_name(&s.fields);
 
     if !fields.is_empty() {
-        if let doctree::Plain = s.struct_type {
+        if let CtorKind::Fictive = s.struct_type {
             sidebar.push_str(&format!(
                 "<a class=\"sidebar-title\" href=\"#fields\">Fields</a>\
                  <div class=\"sidebar-links\">{}</div>",