Skip to content

Commit 6f513ea

Browse files
Add object safety information on traits
1 parent 074f636 commit 6f513ea

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/librustdoc/html/render/print_item.rs

+7
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,13 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
497497

498498
// Output the trait definition
499499
wrap_into_docblock(w, |w| {
500+
if let Some(def_id) = it.def_id.as_def_id() {
501+
write!(
502+
w,
503+
"<div class=\"obj-info\">This trait is <b>{}object safe</b>.</div>",
504+
if cx.tcx().is_object_safe(def_id) { "" } else { "not " }
505+
);
506+
}
500507
wrap_item(w, "trait", |w| {
501508
render_attributes_in_pre(w, it, "");
502509
write!(

0 commit comments

Comments
 (0)