mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-20 02:43:45 +00:00
Make portability part of the summary.
That means it will be visible under "Implementors" on trait pages, and under "Implementations" on struct/enum pages, even when all methods are collapsed. Switch to a float layout for rightside elements.
This commit is contained in:
parent
910c7fa767
commit
593d6d1cb1
@ -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, "</summary>")
|
||||
}
|
||||
if trait_.is_some() {
|
||||
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
||||
write!(w, "<div class=\"item-info\">{}</div>", 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, "<a href=\"#{}\" class=\"anchor\"></a>", id);
|
||||
write!(w, "<div class=\"rightside\">");
|
||||
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("</div>"); // 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, "<div class=\"item-info\">{}</div>", portability);
|
||||
}
|
||||
}
|
||||
|
||||
w.write_str("</div>");
|
||||
}
|
||||
|
||||
|
@ -585,11 +585,14 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
|
||||
if toggled {
|
||||
write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
|
||||
}
|
||||
write!(w, "<div id=\"{}\" class=\"method has-srclink\"><code>", id);
|
||||
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
|
||||
w.write_str("</code>");
|
||||
write!(w, "<div id=\"{}\" class=\"method has-srclink\">", id);
|
||||
write!(w, "<div class=\"rightside\">");
|
||||
render_stability_since(w, m, t, cx.tcx());
|
||||
write_srclink(cx, m, w);
|
||||
write!(w, "</div>");
|
||||
write!(w, "<code>");
|
||||
render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
|
||||
w.write_str("</code>");
|
||||
w.write_str("</div>");
|
||||
if toggled {
|
||||
write!(w, "</summary>");
|
||||
@ -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<Symbol, (DefId, bool)>,
|
||||
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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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<T> 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],
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user