Skip to content

Commit

Permalink
Rollup merge of rust-lang#61263 - GuillaumeGomez:valid-html, r=Manish…
Browse files Browse the repository at this point in the history
…earth

Don't generate div inside header (h4/h3/h...) elements

Fixes rust-lang#60865.

According to the HTML spec, we're not supposed to put `div` elements inside heading elements (h4/h3/h...). It doesn't change the display as far as I could tell.

r? @QuietMisdreavus
  • Loading branch information
Centril authored Jun 1, 2019
2 parents 837df52 + 3509162 commit 525d7de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3804,7 +3804,7 @@ fn render_attributes(w: &mut dyn fmt::Write, it: &clean::Item, top: bool) -> fmt
}
}
if attrs.len() > 0 {
write!(w, "<div class=\"docblock attributes{}\">{}</div>",
write!(w, "<span class=\"docblock attributes{}\">{}</span>",
if top { " top-attr" } else { "" }, &attrs)?;
}
Ok(())
Expand Down
6 changes: 3 additions & 3 deletions src/test/rustdoc/trait-attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// ignore-tidy-linelength

pub trait Foo {
// @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//div[@class="docblock attributes"]' '#[must_use]'
// @has foo/trait.Foo.html '//h3[@id="tymethod.foo"]//span[@class="docblock attributes"]' '#[must_use]'
#[must_use]
fn foo();
}
Expand All @@ -12,11 +12,11 @@ pub trait Foo {
pub struct Bar;

impl Bar {
// @has foo/struct.Bar.html '//h4[@id="method.bar"]//div[@class="docblock attributes"]' '#[must_use]'
// @has foo/struct.Bar.html '//h4[@id="method.bar"]//span[@class="docblock attributes"]' '#[must_use]'
#[must_use]
pub fn bar() {}

// @has foo/struct.Bar.html '//h4[@id="method.bar2"]//div[@class="docblock attributes"]' '#[must_use]'
// @has foo/struct.Bar.html '//h4[@id="method.bar2"]//span[@class="docblock attributes"]' '#[must_use]'
#[must_use]
pub fn bar2() {}
}

0 comments on commit 525d7de

Please sign in to comment.