Skip to content

Commit b6d140e

Browse files
authored
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)
2 parents 6cd8d1d + 79bb6ec commit b6d140e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/librustdoc/html/static/css/rustdoc.css

+1
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,7 @@ in storage.js
18691869
}
18701870

18711871
.variants > .docblock,
1872+
.implementors-toggle > .docblock,
18721873
.impl-items > .rustdoc-toggle[open]:not(:last-child),
18731874
.methods > .rustdoc-toggle[open]:not(:last-child),
18741875
.implementors-toggle[open]:not(:last-child) {

src/test/rustdoc-gui/impl-doc.goml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// A docblock on an impl must have a margin to separate it from the contents.
2+
goto: "file://" + |DOC_PATH| + "/test_docs/struct.TypeWithImplDoc.html"
3+
4+
// The text is about 24px tall, so if there's a margin, then their position will be >24px apart
5+
compare-elements-position-near-false: (
6+
"#implementations-list > .implementors-toggle > .docblock > p",
7+
"#implementations-list > .implementors-toggle > .impl-items",
8+
{"y": 24}
9+
)

src/test/rustdoc-gui/src/test_docs/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,11 @@ pub mod trait_members {
447447
fn function2() {}
448448
}
449449
}
450+
451+
pub struct TypeWithImplDoc;
452+
453+
/// impl doc
454+
impl TypeWithImplDoc {
455+
/// fn doc
456+
pub fn test_fn() {}
457+
}

0 commit comments

Comments
 (0)