Skip to content

Commit 79bb6ec

Browse files
committed
rustdoc: add CSS margin between impl docblock and its items
1 parent 0f529f0 commit 79bb6ec

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
@@ -1872,6 +1872,7 @@ in storage.js
18721872
}
18731873

18741874
.variants > .docblock,
1875+
.implementors-toggle > .docblock,
18751876
.impl-items > .rustdoc-toggle[open]:not(:last-child),
18761877
.methods > .rustdoc-toggle[open]:not(:last-child),
18771878
.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
@@ -442,3 +442,11 @@ pub mod trait_members {
442442
fn function2() {}
443443
}
444444
}
445+
446+
pub struct TypeWithImplDoc;
447+
448+
/// impl doc
449+
impl TypeWithImplDoc {
450+
/// fn doc
451+
pub fn test_fn() {}
452+
}

0 commit comments

Comments
 (0)