diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 4ce14e6eb3ce8..df8cc94d3ee13 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1552,6 +1552,7 @@ fn render_impl( w, cx, i, + parent, outer_version, outer_const_version, show_def_docs, @@ -1562,11 +1563,6 @@ fn render_impl( if toggled { write!(w, "") } - if trait_.is_some() { - if let Some(portability) = portability(&i.impl_item, Some(parent)) { - write!(w, "
{}
", portability); - } - } if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) { let mut ids = cx.id_map.borrow_mut(); @@ -1598,6 +1594,7 @@ pub(crate) fn render_impl_summary( w: &mut Buffer, cx: &Context<'_>, i: &Impl, + parent: &clean::Item, outer_version: Option<&str>, outer_const_version: Option<&str>, show_def_docs: bool, @@ -1652,6 +1649,7 @@ pub(crate) fn render_impl_summary( ); } write!(w, "", id); + write!(w, "
"); render_stability_since_raw( w, i.impl_item.stable_since(tcx).as_deref(), @@ -1660,6 +1658,15 @@ pub(crate) fn render_impl_summary( outer_const_version, ); write_srclink(cx, &i.impl_item, w); + w.write_str("
"); // end of "rightside" + + let is_trait = i.inner_impl().trait_.is_some(); + if is_trait { + if let Some(portability) = portability(&i.impl_item, Some(parent)) { + write!(w, "
{}
", portability); + } + } + w.write_str(""); } diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 5be16d1ce5006..8ad0a80344176 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -585,11 +585,14 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra if toggled { write!(w, "
"); } - write!(w, "
", id); - render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx); - w.write_str(""); + write!(w, "
", id); + write!(w, "
"); render_stability_since(w, m, t, cx.tcx()); write_srclink(cx, m, w); + write!(w, "
"); + write!(w, ""); + render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx); + w.write_str(""); w.write_str("
"); if toggled { write!(w, "
"); @@ -697,6 +700,7 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra w, cx, &implementor, + it, outer_version.as_deref(), outer_const_version.as_deref(), false, @@ -1305,7 +1309,7 @@ fn render_implementor( implementor_dups: &FxHashMap, aliases: &[String], ) { - // If there's already another implementor that has the same abbridged name, use the + // If there's already another implementor that has the same abridged name, use the // full path, for example in `std::iter::ExactSizeIterator` let use_absolute = match implementor.inner_impl().for_ { clean::ResolvedPath { ref path, is_generic: false, .. } @@ -1321,6 +1325,7 @@ fn render_implementor( w, cx, implementor, + trait_, outer_version.as_deref(), outer_const_version.as_deref(), false, diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 7535145caa5c8..e084ee9ca7e34 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -581,7 +581,6 @@ nav.sub { .content .item-info { position: relative; margin-left: 33px; - margin-top: -13px; } .sub-variant > div > .item-info { @@ -852,12 +851,12 @@ body.blur > :not(#help) { } .stab { - display: table; border-width: 1px; border-style: solid; padding: 3px; margin-bottom: 5px; font-size: 90%; + font-weight: normal; } .stab p { display: inline; @@ -906,26 +905,22 @@ body.blur > :not(#help) { } .impl-items .since, .impl .since, .methods .since { - flex-grow: 0; padding-left: 12px; padding-right: 2px; position: initial; } .impl-items .srclink, .impl .srclink, .methods .srclink { - flex-grow: 0; /* Override header settings otherwise it's too bold */ font-size: 17px; font-weight: normal; } -.impl-items code, .impl code, .methods code { - flex-grow: 1; +.rightside { + float: right; } .has-srclink { - display: flex; - flex-basis: 100%; font-size: 16px; margin-bottom: 12px; /* Push the src link out to the right edge consistently */ @@ -986,7 +981,6 @@ a.test-arrow:hover{ } .since + .srclink { - display: table-cell; padding-left: 10px; } diff --git a/src/test/rustdoc/src-links-auto-impls.rs b/src/test/rustdoc/src-links-auto-impls.rs index 6f609e080d3dd..1952f723465d6 100644 --- a/src/test/rustdoc/src-links-auto-impls.rs +++ b/src/test/rustdoc/src-links-auto-impls.rs @@ -2,11 +2,11 @@ // @has foo/struct.Unsized.html // @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized' -// @!has - '//div[@id="impl-Sized"]/a[@class="srclink"]' '[src]' +// @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]' // @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized' -// @!has - '//div[@id="impl-Sync"]/a[@class="srclink"]' '[src]' +// @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]' // @has - '//div[@id="impl-Any"]/code' 'impl Any for T' -// @has - '//div[@id="impl-Any"]/a[@class="srclink"]' '[src]' +// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]' pub struct Unsized { data: [u8], }