Skip to content

Commit

Permalink
Rollup merge of #104744 - notriddle:notriddle/struct-fields-display-b…
Browse files Browse the repository at this point in the history
…lock, r=GuillaumeGomez

rustdoc: give struct fields CSS `display: block`

Fixes #104737
  • Loading branch information
Dylan-DPC committed Nov 23, 2022
2 parents c03026a + 1c80a56 commit a39ed5c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustdoc/html/static/css/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,8 @@ a {
}

.small-section-header {
/* fields use <span> tags, but should get their own lines */
display: block;
position: relative;
}

Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/src/test_docs/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions src/test/rustdoc-gui/struct-fields.goml
Original file line number Diff line number Diff line change
@@ -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| })

0 comments on commit a39ed5c

Please sign in to comment.