Skip to content

Commit bc26199

Browse files
Correctly generate item info of trait items
1 parent 71a7b66 commit bc26199

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/librustdoc/html/render/mod.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ fn render_impl(
16801680
write!(
16811681
&mut doc_buffer,
16821682
"{}",
1683-
document_short(item, cx, link, parent, rendering_params.show_def_docs,)
1683+
document_short(item, cx, link, parent, rendering_params.show_def_docs)
16841684
);
16851685
}
16861686
}
@@ -2043,15 +2043,13 @@ pub(crate) fn render_impl_summary(
20432043
w.write_str("</h3>");
20442044

20452045
let is_trait = inner_impl.trait_.is_some();
2046-
if is_trait {
2047-
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
2048-
write!(
2049-
w,
2050-
"<span class=\"item-info\">\
2051-
<div class=\"stab portability\">{portability}</div>\
2052-
</span>",
2053-
);
2054-
}
2046+
if is_trait && let Some(portability) = portability(&i.impl_item, Some(parent)) {
2047+
write!(
2048+
w,
2049+
"<span class=\"item-info\">\
2050+
<div class=\"stab portability\">{portability}</div>\
2051+
</span>",
2052+
);
20552053
}
20562054

20572055
w.write_str("</section>");

src/librustdoc/html/render/print_item.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use crate::html::format::{
3333
};
3434
use crate::html::layout::Page;
3535
use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine};
36+
use crate::html::render::{document_full, document_item_info};
3637
use crate::html::url_parts_builder::UrlPartsBuilder;
3738
use crate::html::{highlight, static_files};
3839

@@ -818,8 +819,10 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
818819
info!("Documenting {name} on {ty_name:?}", ty_name = t.name);
819820
let item_type = m.type_();
820821
let id = cx.derive_id(format!("{item_type}.{name}"));
822+
821823
let mut content = Buffer::empty_from(w);
822-
write!(&mut content, "{}", document(cx, m, Some(t), HeadingOffset::H5));
824+
write!(content, "{}", document_full(m, cx, HeadingOffset::H5));
825+
823826
let toggled = !content.is_empty();
824827
if toggled {
825828
let method_toggle_class = if item_type.is_method() { " method-toggle" } else { "" };
@@ -836,8 +839,8 @@ fn item_trait(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean:
836839
cx,
837840
RenderMode::Normal,
838841
);
839-
w.write_str("</h4>");
840-
w.write_str("</section>");
842+
w.write_str("</h4></section>");
843+
document_item_info(cx, m, Some(t)).render_into(w).unwrap();
841844
if toggled {
842845
write!(w, "</summary>");
843846
w.push_buffer(content);

0 commit comments

Comments
 (0)