about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-14 10:58:49 +0100
committerGitHub <noreply@github.com>2022-12-14 10:58:49 +0100
commitb6d140e2509092dc0a9877a4014d6dbe7956eabe (patch)
tree0154e54efe91d1886f1e42c1e8dbc0517ea3c43c
parent6cd8d1d4e386482941b63b5ec85465c4d2af8e57 (diff)
parent79bb6ec9ef9490ba74bce0c481d693c1d88db4b4 (diff)
downloadrust-b6d140e2509092dc0a9877a4014d6dbe7956eabe.tar.gz
rust-b6d140e2509092dc0a9877a4014d6dbe7956eabe.zip
Rollup merge of #105676 - notriddle:notriddle/impl-docblock, r=GuillaumeGomez
rustdoc: add CSS margin between `impl` docblock and its items

## Before

![image](https://user-images.githubusercontent.com/1593513/207471025-c27c298b-4d48-461b-918b-a965b09db4f1.png)

## After

![image](https://user-images.githubusercontent.com/1593513/207471759-1bbabf71-0932-441c-b044-ad0e392ba552.png)
-rw-r--r--src/librustdoc/html/static/css/rustdoc.css1
-rw-r--r--src/test/rustdoc-gui/impl-doc.goml9
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs8
3 files changed, 18 insertions, 0 deletions
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index b926ef5c5dd..c485ac9ddb8 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -1869,6 +1869,7 @@ in storage.js
 }
 
 .variants > .docblock,
+.implementors-toggle > .docblock,
 .impl-items > .rustdoc-toggle[open]:not(:last-child),
 .methods > .rustdoc-toggle[open]:not(:last-child),
 .implementors-toggle[open]:not(:last-child) {
diff --git a/src/test/rustdoc-gui/impl-doc.goml b/src/test/rustdoc-gui/impl-doc.goml
new file mode 100644
index 00000000000..7322032b3f5
--- /dev/null
+++ b/src/test/rustdoc-gui/impl-doc.goml
@@ -0,0 +1,9 @@
+// A docblock on an impl must have a margin to separate it from the contents.
+goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html"
+
+// The text is about 24px tall, so if there's a margin, then their position will be >24px apart
+compare-elements-position-near-false: (
+	"#implementations-list > .implementors-toggle > .docblock > p",
+	"#implementations-list > .implementors-toggle > .impl-items",
+	{"y": 24}
+)
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index f55b9ec3af5..f1b69d4dc1d 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -447,3 +447,11 @@ pub mod trait_members {
         fn function2() {}
     }
 }
+
+pub struct TypeWithImplDoc;
+
+/// impl doc
+impl TypeWithImplDoc {
+    /// fn doc
+    pub fn test_fn() {}
+}