about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-11-22 14:48:58 -0700
committerMichael Howell <michael@notriddle.com>2022-11-22 15:10:33 -0700
commit1c80a5655f645dbd0996fa2b05d8443e84576c38 (patch)
tree8a792b4ba966abf97c5f2a4514828a9bb79b1dcb
parente221616639fb87de9dca21e252ee8a2565ec51d0 (diff)
downloadrust-1c80a5655f645dbd0996fa2b05d8443e84576c38.tar.gz
rust-1c80a5655f645dbd0996fa2b05d8443e84576c38.zip
rustdoc: make struct fields `display: block`
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css2
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs5
-rw-r--r--src/test/rustdoc-gui/struct-fields.goml5
3 files changed, 12 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 2335f3ff1ce..97ad00d97ec 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -701,6 +701,8 @@ a {
 }
 
 .small-section-header {
+	/* fields use <span> tags, but should get their own lines */
+	display: block;
 	position: relative;
 }
 
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 8eea5ad01c0..dea154c9319 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -408,6 +408,11 @@ pub struct WithGenerics<T: TraitWithNoDocblocks, S = String, E = WhoLetTheDogOut
     p: P,
 }
 
+pub struct StructWithPublicUndocumentedFields {
+    pub first: u32,
+    pub second: u32,
+}
+
 pub const CONST: u8 = 0;
 
 pub trait TraitWithoutGenerics {
diff --git a/src/test/rustdoc-gui/struct-fields.goml b/src/test/rustdoc-gui/struct-fields.goml
new file mode 100644
index 00000000000..3ec60b58cfd
--- /dev/null
+++ b/src/test/rustdoc-gui/struct-fields.goml
@@ -0,0 +1,5 @@
+goto: "file://" + |DOC_PATH| + "/test_docs/struct.StructWithPublicUndocumentedFields.html"
+
+// Both fields must be on their own line. In other words, they have display: block.
+store-property: (first_top, "//*[@id='structfield.first']", "offsetTop")
+assert-property-false: ("//*[@id='structfield.second']", { "offsetTop": |first_top| })